<html>
 <head>
  <meta charset="utf-8"/>
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"/>
  <title>
   深度学习：CNN的反向求导及练习  | 数螺 | NAUT IDEA
  </title>
  <link href="http://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" rel="stylesheet"/>
  <link href="http://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
  <style type="text/css">
   #xmain img {
                  max-width: 100%;
                  display: block;
                  margin-top: 10px;
                  margin-bottom: 10px;
                }

                #xmain p {
                    line-height:150%;
                    font-size: 16px;
                    margin-top: 20px;
                }

                #xmain h2 {
                    font-size: 24px;
                }

                #xmain h3 {
                    font-size: 20px;
                }

                #xmain h4 {
                    font-size: 18px;
                }


                .header {
	           background-color: #0099ff;
	           color: #ffffff;
	           margin-bottom: 20px;
	        }

	        .header p {
                  margin: 0px;
                  padding: 10px 0;
                  display: inline-block;  
                  vertical-align: middle;
                  font-size: 16px;
               }

               .header a {
                 color: white;
               }

              .header img {
                 height: 25px;
              }
  </style>
  <script src="http://cdn.bootcss.com/jquery/3.0.0/jquery.min.js">
  </script>
  <script src="http://nautstatic-10007657.file.myqcloud.com/static/css/readability.min.js" type="text/javascript">
  </script>
  <script type="text/javascript">
   $(document).ready(function() {
                 var loc = document.location;
                 var uri = {
                  spec: "http://dataunion.org/5395.html",
                  host: "http://dataunion.org",
                  prePath: "http://dataunion.org",
                  scheme: "http",
                  pathBase: "http://dataunion.org/"
                 };
    
                 var documentClone = document.cloneNode(true);
                 var article = new Readability(uri, documentClone).parse();
     
                 document.getElementById("xmain").innerHTML = article.content;
                });
  </script>
  <!-- 1466454723: Accept with keywords: (title(0.333333333333):社区,数盟,深度学习, topn(0.466666666667):导数,权值,数盟,深度学习,神经网络,项为,矩形,结果,特征,假设,元素,敏感性,参数,文章,节点,偏置,教程,函数,卷积,公式,样本,矩阵,问题,算法,梯度下降,误差,离散卷积,网络,人工智能,区域).-->
 </head>
 <body onload="">
  <div class="header">
   <div class="container">
    <div class="row">
     <div class="col-xs-6 col-sm-6 text-left">
      <a href="/databee">
       <img src="http://nautidea-10007657.cos.myqcloud.com/logo_white.png"/>
      </a>
      <a href="/databee">
       <p>
        数螺
       </p>
      </a>
     </div>
     <div class="hidden-xs col-sm-6 text-right">
      <p>
       致力于数据科学的推广和知识传播
      </p>
     </div>
    </div>
   </div>
  </div>
  <div class="container text-center">
   <h1>
    深度学习：CNN的反向求导及练习
   </h1>
  </div>
  <div class="container" id="xmain">
   ﻿﻿
   <title>
    深度学习：CNN的反向求导及练习 | 数盟社区
   </title>
   <!-- All in One SEO Pack 2.2.7.6.2 by Michael Torbert of Semper Fi Web Design[32,63] -->
   <!-- /all in one seo pack -->
   <!--
<div align="center">
<a href="http://strata.oreilly.com.cn/hadoop-big-data-cn?cmp=mp-data-confreg-home-stcn16_dataunion_pc" target="_blank"><img src="http://dataunion.org/wp-content/uploads/2016/05/stratabj.jpg"/ ></a>
</div>
-->
   <header id="header-web">
    <div class="header-main">
     <hgroup class="logo">
      <h1>
       <a href="http://dataunion.org/" rel="home" title="数盟社区">
        <img src="http://dataunion.org/wp-content/themes/yzipi/images/logo.png"/>
       </a>
      </h1>
     </hgroup>
     <!--logo-->
     <nav class="header-nav">
      <ul class="menu" id="menu-%e4%b8%bb%e8%8f%9c%e5%8d%95">
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-has-children menu-item-71" id="menu-item-71">
        <a href="http://dataunion.org/category/events" title="events">
         活动
        </a>
        <ul class="sub-menu">
         <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-22457" id="menu-item-22457">
          <a href="http://dataunion.org/2016timeline">
           2016档期
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-22459" id="menu-item-22459">
          <a href="http://dataunion.org/category/parterc">
           合作会议
          </a>
         </li>
        </ul>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category current-post-ancestor menu-item-has-children menu-item-20869" id="menu-item-20869">
        <a href="http://dataunion.org/category/tech" title="articles">
         文章
        </a>
        <ul class="sub-menu">
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-20867" id="menu-item-20867">
          <a href="http://dataunion.org/category/tech/base" title="base">
           基础架构
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category current-post-ancestor current-menu-parent current-post-parent menu-item-3302" id="menu-item-3302">
          <a href="http://dataunion.org/category/tech/ai" title="ai">
           人工智能
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-3303" id="menu-item-3303">
          <a href="http://dataunion.org/category/tech/analysis" title="analysis">
           数据分析
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-21920" id="menu-item-21920">
          <a href="http://dataunion.org/category/tech/dm">
           数据挖掘
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-3314" id="menu-item-3314">
          <a href="http://dataunion.org/category/tech/viz" title="viz">
           可视化
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-3305" id="menu-item-3305">
          <a href="http://dataunion.org/category/tech/devl" title="devl">
           编程语言
          </a>
         </li>
        </ul>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-has-children menu-item-20876" id="menu-item-20876">
        <a href="http://dataunion.org/category/industry">
         行业
        </a>
        <ul class="sub-menu">
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-16328" id="menu-item-16328">
          <a href="http://dataunion.org/category/industry/case" title="case">
           行业应用
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-2112" id="menu-item-2112">
          <a href="http://dataunion.org/category/industry/demo" title="demo">
           Demo展示
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-21562" id="menu-item-21562">
          <a href="http://dataunion.org/category/industry/news">
           行业资讯
          </a>
         </li>
        </ul>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-311" id="menu-item-311">
        <a href="http://dataunion.org/category/sources" title="sources">
         资源
        </a>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-20870" id="menu-item-20870">
        <a href="http://dataunion.org/category/books" title="book">
         图书
        </a>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-21363" id="menu-item-21363">
        <a href="http://dataunion.org/category/training">
         课程
        </a>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-has-children menu-item-21853" id="menu-item-21853">
        <a href="http://dataunion.org/category/jobs">
         职位
        </a>
        <ul class="sub-menu">
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-22050" id="menu-item-22050">
          <a href="http://dataunion.org/category/career">
           职业规划
          </a>
         </li>
        </ul>
       </li>
      </ul>
     </nav>
     <!--header-nav-->
    </div>
   </header>
   <!--header-web-->
   <div id="main">
    <div id="soutab">
     <form action="http://dataunion.org/" class="search" method="get">
     </form>
    </div>
    <div id="container">
     <nav id="mbx">
      当前位置：
      <a href="http://dataunion.org">
       首页
      </a>
      &gt;
      <a href="http://dataunion.org/category/tech">
       文章
      </a>
      &gt;
      <a href="http://dataunion.org/category/tech/ai">
       人工智能
      </a>
      &gt;  正文
     </nav>
     <!--mbx-->
     <article class="content">
      <header align="centre" class="contenttitle">
       <div class="mscc">
        <h1 class="mscctitle">
         <a href="http://dataunion.org/5395.html">
          深度学习：CNN的反向求导及练习
         </a>
        </h1>
        <address class="msccaddress ">
         <em>
          5,612 次阅读 -
         </em>
         <a href="http://dataunion.org/category/tech/ai" rel="category tag">
          人工智能
         </a>
        </address>
       </div>
      </header>
      <div class="content-text">
       <div id="cnblogs_post_body">
        <div class="Section1">
         <p>
          作者：tornadomeet
         </p>
         <p>
          <strong>
           前言：
          </strong>
         </p>
         <p>
          CNN作为DL中最成功的模型之一，有必要对其更进一步研究它。虽然在前面的博文
          <a href="http://www.cnblogs.com/tornadomeet/archive/2013/05/05/3061457.html">
           Stacked CNN简单介绍
          </a>
          中有大概介绍过CNN的使用，不过那是有个前提的：CNN中的参数必须已提前学习好。而本文的主要目的是介绍CNN参数在使用bp算法时该怎么训练，毕竟CNN中有卷积层和下采样层，虽然和MLP的bp算法本质上相同，但形式上还是有些区别的，很显然在完成CNN反向传播前了解bp算法是必须的。本文的实验部分是参考斯坦福UFLDL新教程
          <a href="http://ufldl.stanford.edu/tutorial/index.php/Exercise:_Convolutional_Neural_Network">
           UFLDL：Exercise: Convolutional Neural Network
          </a>
          里面的内容。完成的是对MNIST数字的识别，采用有监督的CNN网络，当然了，实验很多参数结构都按照教程上给的，这里并没有去调整。
         </p>
         <p>
         </p>
         <p>
          <strong>
           实验基础：
          </strong>
         </p>
         <p>
          CNN反向传播求导时的具体过程可以参考
          <a href="http://cogprints.org/5869/1/cnn_tutorial.pdf">
           论文
          </a>
          <a href="http://cogprints.org/5869/1/cnn_tutorial.pdf">
           Notes on Convolutional Neural Networks,
          </a>
          <a href="http://cogprints.org/5869/1/cnn_tutorial.pdf">
           Jake Bouvrie
          </a>
          ，该论文讲得很全面，比如它考虑了pooling层也加入了权值、偏置值及非线性激发(因为这2种值也需要learn)，对该论文的解读可参考zouxy09的博文
          <a href="http://blog.csdn.net/zouxy09/article/details/9993371">
           CNN卷积神经网络推导和实现
          </a>
          。除了bp算法外，本人认为理解了下面4个子问题，基本上就可以弄懂CNN的求导了（bp算法这里就不多做介绍，网上资料实在是太多了），另外为了讲清楚一些细节过程，本文中举的例子都是简化了一些条件的，且linux下文本和公式编辑太难弄了，文中难免有些地方会出错，大家原谅下。
         </p>
         <p>
          首先我们来看看CNN系统的目标函数，设有样本(xi, yi)共m个，CNN网络共有L层，中间包含若干个卷积层和pooling层，最后一层的输出为f(xi)，则系统的loss表达式为(对权值进行了惩罚，一般分类都采用交叉熵形式)：
         </p>
         <p>
          <img src="http://dataunion.org/wp-content/uploads/2014/12/12191456-39660254cc4c4b8aa051a9de7a0e065d.jpg"/>
         </p>
         <p>
         </p>
         <p>
          <em>
           <strong>
            问题一：求输出层的误差敏感项。
           </strong>
          </em>
         </p>
         <p>
          现在只考虑个一个输入样本(x, y)的情形，loss函数和上面的公式类似是用交叉熵来表示的，暂时不考虑权值规则项，样本标签采用one-hot编码，CNN网络的最后一层采用softmax全连接(多分类时输出层一般用softmax)，样本(x,y)经过CNN网络后的最终的输出用f(x)表示，则对应该样本的loss值为:
         </p>
         <p>
          <img src="http://dataunion.org/wp-content/uploads/2014/12/11171315-e22fdf4ba3ab45cdba3cac12f5888a62.png"/>
         </p>
         <p>
          其中f(x)的下标c的含义见公式：
         </p>
         <p>
          <img src="http://dataunion.org/wp-content/uploads/2014/12/10232822-b40af6ecea5d4a7d9073a1e5bc5c018f.png"/>
         </p>
         <p>
          因为x通过CNN后得到的输出f(x)是一个向量，该向量的元素值都是概率值，分别代表着x被分到各个类中的概率，而f(x)中下标c的意思就是输出向量中取对应c那个类的概率值。
         </p>
         <p>
          采用上面的符号，可以求得此时loss值对输出层的误差敏感性表达式为：
         </p>
         <p>
          <img src="http://dataunion.org/wp-content/uploads/2014/12/10232845-bb355f0257c1475083498a7a756fad18.png"/>
         </p>
         <p>
          其中e(y)表示的是样本x标签值的one-hot表示，其中只有一个元素为1,其它都为0.
         </p>
         <p>
          其推导过程如下（先求出对输出层某个节点c的误差敏感性，参考
          <a href="file:///https://dl.dropboxusercontent.com/u/19557502/2_03_output_layer_gradient.pdf">
           Larochelle关于DL的课件:
          </a>
          <a href="file:///https://dl.dropboxusercontent.com/u/19557502/2_03_output_layer_gradient.pdf">
           Output layer gradient
          </a>
          ）,求出输出层中c节点的误差敏感值：
         </p>
         <p>
          <img src="http://dataunion.org/wp-content/uploads/2014/12/10232857-f9d2c5b4f1de422785e7acddbcd7a970.png"/>
         </p>
         <p>
          由上面公式可知，如果输出层采用sfotmax，且loss用交叉熵形式，则最后一层的误差敏感值就等于CNN网络输出值f(x)减样本标签值e(y),即f(x)-e(y),其形式非常简单，这个公式是不是很眼熟？很多情况下如果model采用MSE的loss，即loss=1/2*(e(y)-f(x))^2，那么loss对最终的输出f(x)求导时其结果就是f(x)-e(y),虽然和上面的结果一样，但是大家不要搞混淆了，这2个含义是不同的，一个是对输出层节点输入值的导数(softmax激发函数)，一个是对输出层节点输出值的导数(任意激发函数）。而在使用MSE的loss表达式时，输出层的误差敏感项为(f(x)-e(y)).*f(x)’，两者只相差一个因子。
         </p>
         <p>
          这样就可以求出第L层的权值W的偏导数：
         </p>
         <p>
          <img src="http://dataunion.org/wp-content/uploads/2014/12/11083750-552582e45f1648088345d3838f693eb0.png"/>
         </p>
         <p>
          输出层偏置的偏导数：
         </p>
         <p>
          <img src="http://dataunion.org/wp-content/uploads/2014/12/11083759-c6a7326a617947b4b67becf3c6884c7c.png"/>
         </p>
         <p>
          上面2个公式的e(y)和f(x)是一个矩阵，已经把所有m个训练样本考虑进去了,每一列代表一个样本。
         </p>
         <p>
         </p>
         <p>
          <em>
           <strong>
            问题二：当接在卷积层的下一层为pooling层时，求卷积层的误差敏感项。
           </strong>
          </em>
         </p>
         <p>
          假设第l(小写的l，不要看成数字’1’了)层为卷积层，第l+1层为pooling层，且pooling层的误差敏感项为：
          <img src="http://dataunion.org/wp-content/uploads/2014/12/10233031-f52820fe834e42dc96a4cc7a5b58705f.png"/>
          ,卷积层的误差敏感项为：
          <img src="http://dataunion.org/wp-content/uploads/2014/12/10233042-6242eed2c71641c19113ca8f1046ddd5.png"/>
          , 则两者的关系表达式为：
         </p>
         <p>
          <img src="http://dataunion.org/wp-content/uploads/2014/12/11080853-06c3fdc33e66423490d7560de2cbbeb9.png"/>
         </p>
         <p>
          这里符号●表示的是矩阵的点积操作，即对应元素的乘积。卷积层和unsample()后的pooling层节点是一一对应的，所以下标都是用j表示。后面的符号
          <img src="http://dataunion.org/wp-content/uploads/2014/12/11081018-e68028bc98334a07bc495255350769e6.png"/>
          表示的是第l层第j个节点处激发函数的导数(对节点输入的导数)。
         </p>
         <p>
          其中的函数unsample()为上采样过程，其具体的操作得看是采用的什么pooling方法了。但unsample的大概思想为：pooling层的每个节点是由卷积层中多个节点(一般为一个矩形区域)共同计算得到，所以pooling层每个节点的误差敏感值也是由卷积层中多个节点的误差敏感值共同产生的，只需满足两层见各自的误差敏感值相等，下面以mean-pooling和max-pooling为例来说明。
         </p>
         <p>
          假设卷积层的矩形大小为4×4, pooling区域大小为2×2, 很容易知道pooling后得到的矩形大小也为2*2（本文默认pooling过程是没有重叠的，卷积过程是每次移动一个像素，即是有重叠的，后续不再声明）,如果此时pooling后的矩形误差敏感值如下：
         </p>
         <p>
          <img src="http://dataunion.org/wp-content/uploads/2014/12/10233105-9657d1b38edf4044b07f8b3347754e70.png"/>
         </p>
         <p>
          则按照mean-pooling，首先得到的卷积层应该是4×4大小，其值分布为(等值复制)：
         </p>
         <p>
          <img src="http://dataunion.org/wp-content/uploads/2014/12/10233115-9cbea2eca9974a848d3f94cfc60b6a7f.jpg"/>
         </p>
         <p>
          因为得满足反向传播时各层间误差敏感总和不变，所以卷积层对应每个值需要平摊（除以pooling区域大小即可，这里pooling层大小为2×2=4)），最后的卷积层值
         </p>
         <p>
          分布为：
         </p>
         <p>
          <img src="http://dataunion.org/wp-content/uploads/2014/12/10233136-9eead4aaabe542a387f83213df7bf795.jpg"/>
         </p>
         <p>
          mean-pooling时的unsample操作可以使用matalb中的函数kron()来实现，因为是采用的矩阵Kronecker乘积。C=kron(A, B)表示的是矩阵B分别与矩阵A中每个元素相乘，然后将相乘的结果放在C中对应的位置。比如：
         </p>
         <p>
          <img src="http://dataunion.org/wp-content/uploads/2014/12/11085402-6d05724b46a34e8489b07f84bcb5415f.png"/>
         </p>
         <p>
          如果是max-pooling，则需要记录前向传播过程中pooling区域中最大值的位置，这里假设pooling层值1,3,2,4对应的pooling区域位置分别为右下、右上、左上、左下。则此时对应卷积层误差敏感值分布为：
         </p>
         <p>
          <img src="http://dataunion.org/wp-content/uploads/2014/12/10233156-42bf23327122472794cda8fa31ac938a.jpg"/>
         </p>
         <p>
          当然了，上面2种结果还需要点乘卷积层激发函数对应位置的导数值了，这里省略掉。
         </p>
         <p>
         </p>
         <p>
          <em>
           <strong>
            问题三：当接在pooling层的下一层为卷积层时，求该pooling层的误差敏感项。
           </strong>
          </em>
         </p>
         <p>
          假设第l层(pooling层)有N个通道，即有N张特征图，第l+1层(卷积层)有M个特征，l层中每个通道图都对应有自己的误差敏感值，其计算依据为第l+1层所有特征核的贡献之和。下面是第l+1层中第j个核对第l层第i个通道的误差敏感值计算方法：
         </p>
         <p>
          <img src="http://dataunion.org/wp-content/uploads/2014/12/10233224-de029dc4d24a40e0b6ad19289184ee43.png"/>
         </p>
         <p>
          符号★表示的是矩阵的卷积操作，这是真正意义上的离散卷积，不同于卷积层前向传播时的相关操作，因为严格意义上来讲，卷积神经网络中的卷积操作本质是一个相关操作，并不是卷积操作，只不过它可以用卷积的方法去实现才这样叫。而求第i个通道的误差敏感项时需要将l+1层的所有核都计算一遍，然后求和。另外因为这里默认pooling层是线性激发函数，所以后面没有乘相应节点的导数。
         </p>
         <p>
          举个简单的例子，假设拿出第l层某个通道图，大小为3×3，第l+1层有2个特征核，核大小为2×2，则在前向传播卷积时第l+1层会有2个大小为2×2的卷积图。如果2个特征核分别为：
         </p>
         <p>
          <img src="http://dataunion.org/wp-content/uploads/2014/12/10233241-3ebb0136cb1c48be8aec09f43b84a7af.jpg"/>
          <img src="http://dataunion.org/wp-content/uploads/2014/12/10233254-791913858c8642af9bb0895ce72b6feb.jpg"/>
         </p>
         <p>
          反向传播求误差敏感项时，假设已经知道第l+1层2个卷积图的误差敏感值：
         </p>
         <p>
          <img src="http://dataunion.org/wp-content/uploads/2014/12/10233313-9a3a45cb982f4670bd901569959def95.jpg"/>
          <img src="http://dataunion.org/wp-content/uploads/2014/12/10233340-713919c4ed1347f09a8201e31545c939.jpg"/>
         </p>
         <p>
          离散卷积函数conv2()的实现相关子操作时需先将核旋转180度(即左右翻转后上下翻转)，但这里实现的是严格意义上的卷积，所以在用conv2()时，对应的参数核不需要翻转（在有些toolbox里面，求这个问题时用了旋转，那是因为它们已经把所有的卷积核都旋转过，这样在前向传播时的相关操作就不用旋转了。并不矛盾）。且这时候该函数需要采用’full’模式，所以最终得到的矩阵大小为3×3,（其中3=2+2-1）,刚好符第l层通道图的大小。采用’full’模式需先将第l+1层2个卷积图扩充，周围填0,padding后如下：
         </p>
         <p>
          <img src="http://dataunion.org/wp-content/uploads/2014/12/10233353-308b9c9421e14dba8ab3b57ddff6c3781.jpg"/>
          <img src="http://dataunion.org/wp-content/uploads/2014/12/10233407-84adb9653b7d46f09aa66cafae73407a.jpg"/>
         </p>
         <p>
          扩充后的矩阵和对应的核进行卷积的结果如下情况：
         </p>
         <p>
          <img src="http://dataunion.org/wp-content/uploads/2014/12/10233436-408a944e41604c199f8470414dac4aa3.png"/>
         </p>
         <p>
          <img src="http://dataunion.org/wp-content/uploads/2014/12/10233452-d20e97b0ed1044ae981a798cb36e8a54.png"/>
         </p>
         <p>
          可以通过手动去验证上面的结果，因为是离散卷积操作，而离散卷积等价于将核旋转后再进行相关操作。而第l层那个通道的误差敏感项为上面2者的和，呼应问题三，最终答案为：
         </p>
         <p>
          <img src="http://dataunion.org/wp-content/uploads/2014/12/11000103-da4fac3f557948b6a128b39fe21f695a.png"/>
         </p>
         <p>
          那么这样问题3这样解的依据是什么呢？其实很简单，本质上还是bp算法，即第l层的误差敏感值等于第l+1层的误差敏感值乘以两者之间的权值，只不过这里由于是用了卷积，且是有重叠的，l层中某个点会对l+1层中的多个点有影响。比如说最终的结果矩阵中最中间那个0.3是怎么来的呢？在用2×2的核对3×3的输入矩阵进行卷积时，一共进行了4次移动，而3×3矩阵最中间那个值在4次移动中均对输出结果有影响，且4次的影响分别在右下角、左下角、右上角、左上角。所以它的值为2×0.2+1×0.1+1×0.1-1×0.3=0.3, 建议大家用笔去算一下，那样就可以明白为什么这里可以采用带’full’类型的conv2()实现。
         </p>
         <p>
         </p>
         <p>
          <em>
           <strong>
            问题四：求与卷积层相连那层的权值、偏置值导数。
           </strong>
          </em>
         </p>
         <p>
          前面3个问题分别求得了输出层的误差敏感值、从pooling层推断出卷积层的误差敏感值、从卷积层推断出pooling层的误差敏感值。下面需要利用这些误差敏感值模型中参数的导数。这里没有考虑pooling层的非线性激发，因此pooling层前面是没有权值的，也就没有所谓的权值的导数了。现在将主要精力放在卷积层前面权值的求导上(也就是问题四)。
         </p>
         <p>
          假设现在需要求第l层的第i个通道，与第l+1层的第j个通道之间的权值和偏置的导数，则计算公式如下：
         </p>
         <p>
          <img src="http://dataunion.org/wp-content/uploads/2014/12/11091529-b07a8331ddbf49e2b08a3dfd4bc990e6.png"/>
         </p>
         <p>
          其中符号⊙表示矩阵的相关操作，可以采用conv2()函数实现。在使用该函数时，需将第l+1层第j个误差敏感值翻转。
         </p>
         <p>
          例如，如果第l层某个通道矩阵i大小为4×4,如下：
         </p>
         <p>
          <img src="http://dataunion.org/wp-content/uploads/2014/12/10233932-19b796c090f840b28aca289295b78a9a.jpg"/>
         </p>
         <p>
          第l+1层第j个特征的误差敏感值矩阵大小为3×3,如下：
         </p>
         <p>
          <img src="http://dataunion.org/wp-content/uploads/2014/12/10233954-b5b06bab27e04d9e8336c0a427f3504f.jpg"/>
         </p>
         <p>
          很明显，这时候的特征Kij导数的大小为2×2的，且其结果为：
         </p>
         <p>
          <img src="http://dataunion.org/wp-content/uploads/2014/12/11001753-863c64fb2b7a4d988437c0bcc903085a.png"/>
         </p>
         <p>
          而此时偏置值bj的导数为1.2 ，将j区域的误差敏感值相加即可(0.8+0.1-0.6+0.3+0.5+0.7-0.4-0.2=1.2)，因为b对j中的每个节点都有贡献，按照多项式的求导规则(和的导数等于导数的和)很容易得到。
         </p>
         <p>
          为什么采用矩阵的相关操作就可以实现这个功能呢？由bp算法可知，l层i和l+1层j之间的权值等于l+1层j处误差敏感值乘以l层i处的输入，而j中某个节点因为是由i+1中一个区域与权值卷积后所得，所以j处该节点的误差敏感值对权值中所有元素都有贡献，由此可见，将j中每个元素对权值的贡献(尺寸和核大小相同)相加，就得到了权值的偏导数了(这个例子的结果是由9个2×2大小的矩阵之和)，同样，如果大家动笔去推算一下，就会明白这时候为什么可以用带’valid’的conv2()完成此功能。
         </p>
         <p>
         </p>
         <p>
          <strong>
           实验总结：
          </strong>
         </p>
         <ol>
          <li>
           卷积层过后，可以先跟pooling层，再通过非线性传播函数。也可以是先通过非线性传播函数再经过pooling层。
          </li>
          <li>
           CNN的结构本身就是一种规则项。
          </li>
          <li>
           实际上每个权值的学习率不同时优化会更好。
          </li>
          <li>
           发现Ng以前的ufldl中教程里面softmax并没有包含偏置值参数，至少他给的start code里面没有包含，严格来说是错误的。
          </li>
          <li>
           当输入样本为多个时，bp算法中的误差敏感性也是一个矩阵。每一个样本都对应有自己每层的误差敏感性。
          </li>
          <li>
           血的教训啊，以后循环变量名不能与终止名太相似，一不小心引用下标是就弄错，比如for filterNum = 1:numFilters 时一不小心把下标用numFilters去代替了，花了大半天去查这个debug.
          </li>
         </ol>
         <p>
          7.  matlab中conv2()函数在卷积过程中默认是每次移动一个像素，即重叠度最高的卷积。
         </p>
         <p>
         </p>
         <p>
          <strong>
           实验结果：
          </strong>
         </p>
         <p>
          按照网页教程
          <a href="http://ufldl.stanford.edu/tutorial/index.php/Exercise:_Convolutional_Neural_Network">
           UFLDL：Exercise: Convolutional Neural Network
          </a>
          和
          <a href="http://ufldl.stanford.edu/tutorial/index.php/Optimization:_Stochastic_Gradient_Descent">
           UFLDL：Optimization: Stochastic Gradient Descent
          </a>
          ，对MNIST数据库进行识别，完成练习中YOU CODE HERE部分后，该CNN网络的识别率为：
         </p>
         <p>
          <strong>
           95.76%
          </strong>
         </p>
         <p>
          只采用了一个卷积层+一个pooling层+一个softmax层。卷积层的特征个数为20,卷积核大小为9×9, pooling区域大小为2×2.
         </p>
         <p>
          在进行实验前，需下载好本实验的标准代码：
          <a href="https://github.com/amaas/stanford_dl_ex">
           https://github.com/amaas/stanford_dl_ex
          </a>
          。
         </p>
         <p>
          然后在common文件夹放入下载好的MNIST数据库，见
          <a href="http://yann.lecun.com/exdb/mnist/">
           http://yann.lecun.com/exdb/mnist/
          </a>
          .注意MNIST文件名需要和代码中的保持一致。
         </p>
         <p>
         </p>
         <p>
          <strong>
           实验代码：
          </strong>
         </p>
         <p>
          <em>
           <strong>
            cnnTrain.m:
           </strong>
          </em>
         </p>
         <div class="cnblogs_code">
          <div class="cnblogs_code_toolbar">
           <span class="cnblogs_code_copy">
            <p title="复制代码">
             <img src="http://dataunion.org/wp-content/uploads/2014/12/copycode3.gif"/>
            </p>
           </span>
          </div>
          <p>
          </p>
          <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
          <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-576852be007c8176648146" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
           <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
            <span class="crayon-title">
            </span>
            <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
             <span class="crayon-mixed-highlight" title="含多种语言">
             </span>
             <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
              <div class="crayon-button-icon">
              </div>
             </div>
             <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
              <div class="crayon-button-icon">
              </div>
             </div>
             <div class="crayon-button crayon-wrap-button" title="切换自动换行">
              <div class="crayon-button-icon">
              </div>
             </div>
             <div class="crayon-button crayon-expand-button" title="点击展开代码">
              <div class="crayon-button-icon">
              </div>
             </div>
             <div class="crayon-button crayon-copy-button" title="复制代码">
              <div class="crayon-button-icon">
              </div>
             </div>
             <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
              <div class="crayon-button-icon">
              </div>
             </div>
            </div>
           </div>
           <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
           </div>
           <div class="crayon-plain-wrap">
            <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
             %% Convolution Neural Network Exercise

%  Instructions
%  ------------
% 
%  This file contains code that helps you get started in building a single.
%  layer convolutional nerual network. In this exercise, you will only
%  need to modify cnnCost.m and cnnminFuncSGD.m. You will not need to 
%  modify this file.

%%======================================================================
%% STEP 0: Initialize Parameters and Load Data
%  Here we initialize some parameters used for the exercise.

% Configuration
imageDim = 28;
numClasses = 10;  % Number of classes (MNIST images fall into 10 classes)
filterDim = 9;    % Filter size for conv layer,9*9
numFilters = 20;   % Number of filters for conv layer
poolDim = 2;      % Pooling dimension, (should divide imageDim-filterDim+1)

% Load MNIST Train
addpath ./common/; 
images = loadMNISTImages('./common/train-images-idx3-ubyte');
images = reshape(images,imageDim,imageDim,[]);
labels = loadMNISTLabels('./common/train-labels-idx1-ubyte');
labels(labels==0) = 10; % Remap 0 to 10

% Initialize Parameters,theta=(2165,1),2165=9*9*20+20+100*20*10+10
theta = cnnInitParams(imageDim,filterDim,numFilters,poolDim,numClasses);

%%======================================================================
%% STEP 1: Implement convNet Objective
%  Implement the function cnnCost.m.

%%======================================================================
%% STEP 2: Gradient Check
%  Use the file computeNumericalGradient.m to check the gradient
%  calculation for your cnnCost.m function.  You may need to add the
%  appropriate path or copy the file to this directory.

DEBUG=false;  % set this to true to check gradient
%DEBUG = true;
if DEBUG
    % To speed up gradient checking, we will use a reduced network and
    % a debugging data set
    db_numFilters = 2;
    db_filterDim = 9;
    db_poolDim = 5;
    db_images = images(:,:,1:10);
    db_labels = labels(1:10);
    db_theta = cnnInitParams(imageDim,db_filterDim,db_numFilters,...
                db_poolDim,numClasses);
    
    [cost grad] = cnnCost(db_theta,db_images,db_labels,numClasses,...
                                db_filterDim,db_numFilters,db_poolDim);
    

    % Check gradients
    numGrad = computeNumericalGradient( @(x) cnnCost(x,db_images,...
                                db_labels,numClasses,db_filterDim,...
                                db_numFilters,db_poolDim), db_theta);
 
    % Use this to visually compare the gradients side by side
    disp([numGrad grad]);
    
    diff = norm(numGrad-grad)/norm(numGrad+grad);
    % Should be small. In our implementation, these values are usually 
    % less than 1e-9.
    disp(diff); 
 
    assert(diff &amp;lt; 1e-9,...
        'Difference too large. Check your gradient computation again');
    
end;

%%======================================================================
%% STEP 3: Learn Parameters
%  Implement minFuncSGD.m, then train the model.

% 因为是采用的mini-batch梯度下降法，所以总共对样本的循环次数次数比标准梯度下降法要少
% 很多，因为每次循环中权值已经迭代多次了
options.epochs = 3; 
options.minibatch = 256;
options.alpha = 1e-1;
options.momentum = .95;

opttheta = minFuncSGD(@(x,y,z) cnnCost(x,y,z,numClasses,filterDim,...
                      numFilters,poolDim),theta,images,labels,options);
save('theta.mat','opttheta');             

%%======================================================================
%% STEP 4: Test
%  Test the performance of the trained model using the MNIST test set. Your
%  accuracy should be above 97% after 3 epochs of training

testImages = loadMNISTImages('./common/t10k-images-idx3-ubyte');
testImages = reshape(testImages,imageDim,imageDim,[]);
testLabels = loadMNISTLabels('./common/t10k-labels-idx1-ubyte');
testLabels(testLabels==0) = 10; % Remap 0 to 10

[~,cost,preds]=cnnCost(opttheta,testImages,testLabels,numClasses,...
                filterDim,numFilters,poolDim,true);

acc = sum(preds==testLabels)/length(preds);

% Accuracy should be around 97.4% after 3 epochs
fprintf('Accuracy is %f\n',acc);
            </textarea>
           </div>
           <div class="crayon-main" style="">
            <table class="crayon-table">
             <tbody>
              <tr class="crayon-row">
               <td class="crayon-nums " data-settings="show">
                <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-1">
                  1
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-2">
                  2
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-3">
                  3
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-4">
                  4
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-5">
                  5
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-6">
                  6
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-7">
                  7
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-8">
                  8
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-9">
                  9
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-10">
                  10
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-11">
                  11
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-12">
                  12
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-13">
                  13
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-14">
                  14
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-15">
                  15
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-16">
                  16
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-17">
                  17
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-18">
                  18
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-19">
                  19
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-20">
                  20
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-21">
                  21
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-22">
                  22
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-23">
                  23
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-24">
                  24
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-25">
                  25
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-26">
                  26
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-27">
                  27
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-28">
                  28
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-29">
                  29
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-30">
                  30
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-31">
                  31
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-32">
                  32
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-33">
                  33
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-34">
                  34
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-35">
                  35
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-36">
                  36
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-37">
                  37
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-38">
                  38
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-39">
                  39
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-40">
                  40
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-41">
                  41
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-42">
                  42
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-43">
                  43
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-44">
                  44
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-45">
                  45
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-46">
                  46
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-47">
                  47
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-48">
                  48
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-49">
                  49
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-50">
                  50
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-51">
                  51
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-52">
                  52
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-53">
                  53
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-54">
                  54
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-55">
                  55
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-56">
                  56
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-57">
                  57
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-58">
                  58
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-59">
                  59
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-60">
                  60
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-61">
                  61
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-62">
                  62
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-63">
                  63
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-64">
                  64
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-65">
                  65
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-66">
                  66
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-67">
                  67
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-68">
                  68
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-69">
                  69
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-70">
                  70
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-71">
                  71
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-72">
                  72
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-73">
                  73
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-74">
                  74
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-75">
                  75
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-76">
                  76
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-77">
                  77
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-78">
                  78
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-79">
                  79
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-80">
                  80
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-81">
                  81
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-82">
                  82
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-83">
                  83
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-84">
                  84
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-85">
                  85
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-86">
                  86
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-87">
                  87
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-88">
                  88
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-89">
                  89
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-90">
                  90
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-91">
                  91
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-92">
                  92
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-93">
                  93
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-94">
                  94
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-95">
                  95
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-96">
                  96
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-97">
                  97
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-98">
                  98
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-99">
                  99
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-100">
                  100
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-101">
                  101
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-102">
                  102
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-103">
                  103
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-104">
                  104
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-105">
                  105
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-106">
                  106
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-107">
                  107
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-108">
                  108
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-109">
                  109
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-110">
                  110
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-111">
                  111
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-112">
                  112
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-113">
                  113
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-114">
                  114
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-115">
                  115
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-116">
                  116
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-117">
                  117
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-118">
                  118
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-119">
                  119
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-120">
                  120
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-121">
                  121
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-122">
                  122
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-123">
                  123
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-124">
                  124
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-125">
                  125
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-126">
                  126
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-127">
                  127
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-128">
                  128
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-129">
                  129
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-130">
                  130
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-131">
                  131
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-132">
                  132
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-133">
                  133
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-134">
                  134
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-135">
                  135
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-136">
                  136
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-137">
                  137
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-138">
                  138
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-139">
                  139
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007c8176648146-140">
                  140
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007c8176648146-141">
                  141
                 </div>
                </div>
               </td>
               <td class="crayon-code">
                <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                 <div class="crayon-line" id="crayon-576852be007c8176648146-1">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Convolution
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Neural
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Network
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Exercise
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-2">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-3">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-4">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Instructions
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-5">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-6">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-7">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-8">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-9">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-10">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   This
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-t">
                   file
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   contains
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   code
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   that
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   helps
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   you
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   get
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   started
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   in
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   building
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   a
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   single
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-11">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-12">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   layer
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   convolutional
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   nerual
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   network
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   In
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   this
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   exercise
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   you
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   will
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   only
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-13">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-14">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   need
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   to
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   modify
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   cnnCost
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-i">
                   m
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   and
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   cnnminFuncSGD
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-v">
                   m
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   You
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   will
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   not
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   need
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   to
                  </span>
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-15">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-16">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   modify
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   this
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-t">
                   file
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-17">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-18">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-19">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-o">
                   %=
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-20">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-21">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   STEP
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   0
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Initialize
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Parameters
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   and
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Load
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-t">
                   Data
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-22">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-23">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Here
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   we
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   initialize
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   some
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   parameters
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   used
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   for
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   exercise
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-24">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-25">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-26">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Configuration
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-27">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-28">
                  <span class="crayon-v">
                   imageDim
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   28
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-29">
                  <span class="crayon-v">
                   numClasses
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   10
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   Number
                  </span>
                  <span class="crayon-e">
                   of
                  </span>
                  <span class="crayon-e">
                   classes
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-e">
                   MNIST
                  </span>
                  <span class="crayon-e">
                   images
                  </span>
                  <span class="crayon-e">
                   fall
                  </span>
                  <span class="crayon-i">
                   into
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   10
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   classes
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-30">
                  <span class="crayon-v">
                   filterDim
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   9
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   Filter
                  </span>
                  <span class="crayon-e">
                   size
                  </span>
                  <span class="crayon-st">
                   for
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   conv
                  </span>
                  <span class="crayon-v">
                   layer
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-cn">
                   9
                  </span>
                  <span class="crayon-o">
                   *
                  </span>
                  <span class="crayon-cn">
                   9
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-31">
                  <span class="crayon-v">
                   numFilters
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   20
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   Number
                  </span>
                  <span class="crayon-e">
                   of
                  </span>
                  <span class="crayon-e">
                   filters
                  </span>
                  <span class="crayon-st">
                   for
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   conv
                  </span>
                  <span class="crayon-e">
                   layer
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-32">
                  <span class="crayon-v">
                   poolDim
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   2
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   Pooling
                  </span>
                  <span class="crayon-v">
                   dimension
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-e">
                   should
                  </span>
                  <span class="crayon-e">
                   divide
                  </span>
                  <span class="crayon-v">
                   imageDim
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-v">
                   filterDim
                  </span>
                  <span class="crayon-o">
                   +
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-33">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-34">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Load
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   MNIST
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Train
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-35">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-36">
                  <span class="crayon-i">
                   addpath
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-o">
                   /
                  </span>
                  <span class="crayon-v">
                   common
                  </span>
                  <span class="crayon-o">
                   /
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-37">
                  <span class="crayon-v">
                   images
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   loadMNISTImages
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-s">
                   './common/train-images-idx3-ubyte'
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-38">
                  <span class="crayon-v">
                   images
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   reshape
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   images
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   imageDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   imageDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-sy">
                   [
                  </span>
                  <span class="crayon-sy">
                   ]
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-39">
                  <span class="crayon-v">
                   labels
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   loadMNISTLabels
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-s">
                   './common/train-labels-idx1-ubyte'
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-40">
                  <span class="crayon-e">
                   labels
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   labels
                  </span>
                  <span class="crayon-o">
                   ==
                  </span>
                  <span class="crayon-cn">
                   0
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   10
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   Remap
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   0
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   to
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   10
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-41">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-42">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Initialize
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   Parameters
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   theta
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-cn">
                   2165
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-cn">
                   2165
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-cn">
                   9
                  </span>
                  <span class="crayon-o">
                   *
                  </span>
                  <span class="crayon-cn">
                   9
                  </span>
                  <span class="crayon-o">
                   *
                  </span>
                  <span class="crayon-cn">
                   20
                  </span>
                  <span class="crayon-o">
                   +
                  </span>
                  <span class="crayon-cn">
                   20
                  </span>
                  <span class="crayon-o">
                   +
                  </span>
                  <span class="crayon-cn">
                   100
                  </span>
                  <span class="crayon-o">
                   *
                  </span>
                  <span class="crayon-cn">
                   20
                  </span>
                  <span class="crayon-o">
                   *
                  </span>
                  <span class="crayon-cn">
                   10
                  </span>
                  <span class="crayon-o">
                   +
                  </span>
                  <span class="crayon-cn">
                   10
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-43">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-44">
                  <span class="crayon-v">
                   theta
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   cnnInitParams
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   imageDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   filterDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   numFilters
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   poolDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   numClasses
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-45">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-46">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-o">
                   %=
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-47">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-48">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   STEP
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Implement
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   convNet
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Objective
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-49">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-50">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Implement
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   function
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   cnnCost
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-v">
                   m
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-51">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-52">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-53">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-o">
                   %=
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-54">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-55">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   STEP
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   2
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Gradient
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Check
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-56">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-57">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Use
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-t">
                   file
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   computeNumericalGradient
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-i">
                   m
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   to
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   check
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   gradient
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-58">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-59">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   calculation
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   for
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   your
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   cnnCost
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-i">
                   m
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   function
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   You
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   may
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   need
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   to
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   add
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-60">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-61">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   appropriate
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   path
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   or
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   copy
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-t">
                   file
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   to
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   this
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   directory
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-62">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-63">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-64">
                  <span class="crayon-v">
                   DEBUG
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-t">
                   false
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   set
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-r">
                   this
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   to
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-t">
                   true
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   to
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   check
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   gradient
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-65">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-v">
                   DEBUG
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-r">
                   true
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-66">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-67">
                  <span class="crayon-st">
                   if
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   DEBUG
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-68">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   To
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   speed
                  </span>
                  <span class="crayon-e">
                   up
                  </span>
                  <span class="crayon-e">
                   gradient
                  </span>
                  <span class="crayon-v">
                   checking
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   we
                  </span>
                  <span class="crayon-e">
                   will
                  </span>
                  <span class="crayon-st">
                   use
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   a
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   reduced
                  </span>
                  <span class="crayon-e">
                   network
                  </span>
                  <span class="crayon-st">
                   and
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-69">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   a
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   debugging
                  </span>
                  <span class="crayon-e">
                   data
                  </span>
                  <span class="crayon-e">
                   set
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-70">
                  <span class="crayon-e">
                  </span>
                  <span class="crayon-v">
                   db_numFilters
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   2
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-71">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   db_filterDim
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   9
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-72">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   db_poolDim
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   5
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-73">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   db_images
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   images
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-cn">
                   10
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-74">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   db_labels
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   labels
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-cn">
                   10
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-75">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   db_theta
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   cnnInitParams
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   imageDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   db_filterDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   db_numFilters
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-76">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   db_poolDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   numClasses
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-77">
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-78">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-sy">
                   [
                  </span>
                  <span class="crayon-e">
                   cost
                  </span>
                  <span class="crayon-v">
                   grad
                  </span>
                  <span class="crayon-sy">
                   ]
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   cnnCost
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   db_theta
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   db_images
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   db_labels
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   numClasses
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-79">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   db_filterDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   db_numFilters
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   db_poolDim
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-80">
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-81">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-82">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   Check
                  </span>
                  <span class="crayon-e">
                   gradients
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-83">
                  <span class="crayon-e">
                  </span>
                  <span class="crayon-v">
                   numGrad
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   computeNumericalGradient
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-sy">
                   @
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   x
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   cnnCost
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   x
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   db_images
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-84">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   db_labels
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   numClasses
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   db_filterDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-85">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   db_numFilters
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   db_poolDim
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   db_theta
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-86">
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-87">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   Use
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-r">
                   this
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   to
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   visually
                  </span>
                  <span class="crayon-e">
                   compare
                  </span>
                  <span class="crayon-e">
                   the
                  </span>
                  <span class="crayon-e">
                   gradients
                  </span>
                  <span class="crayon-e">
                   side
                  </span>
                  <span class="crayon-e">
                   by
                  </span>
                  <span class="crayon-e">
                   side
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-88">
                  <span class="crayon-e">
                  </span>
                  <span class="crayon-e">
                   disp
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-sy">
                   [
                  </span>
                  <span class="crayon-e">
                   numGrad
                  </span>
                  <span class="crayon-v">
                   grad
                  </span>
                  <span class="crayon-sy">
                   ]
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-89">
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-90">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   diff
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   norm
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   numGrad
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-v">
                   grad
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-o">
                   /
                  </span>
                  <span class="crayon-e">
                   norm
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   numGrad
                  </span>
                  <span class="crayon-o">
                   +
                  </span>
                  <span class="crayon-v">
                   grad
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-91">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   Should
                  </span>
                  <span class="crayon-e">
                   be
                  </span>
                  <span class="crayon-v">
                   small
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   In
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   our
                  </span>
                  <span class="crayon-v">
                   implementation
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   these
                  </span>
                  <span class="crayon-e">
                   values
                  </span>
                  <span class="crayon-e">
                   are
                  </span>
                  <span class="crayon-v">
                   usually
                  </span>
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-92">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   less
                  </span>
                  <span class="crayon-i">
                   than
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   1e
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-cn">
                   9.
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-93">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   disp
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   diff
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-94">
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-95">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   assert
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   diff
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   &amp;
                  </span>
                  <span class="crayon-v">
                   lt
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   1e
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-cn">
                   9
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-96">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-s">
                   'Difference too large. Check your gradient computation again'
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-97">
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-98">
                  <span class="crayon-st">
                   end
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-99">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-100">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-o">
                   %=
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-101">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-102">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   STEP
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   3
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Learn
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Parameters
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-103">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-104">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Implement
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   minFuncSGD
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-v">
                   m
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   then
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   train
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   model
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-105">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-106">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-107">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  因为是采用的
                  <span class="crayon-v">
                   mini
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-i">
                   batch
                  </span>
                  梯度下降法，所以总共对样本的循环次数次数比标准梯度下降法要少
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-108">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-109">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  很多，因为每次循环中权值已经迭代多次了
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-110">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-111">
                  <span class="crayon-v">
                   options
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-v">
                   epochs
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   3
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-112">
                  <span class="crayon-v">
                   options
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-v">
                   minibatch
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   256
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-113">
                  <span class="crayon-v">
                   options
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-v">
                   alpha
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   1e
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-114">
                  <span class="crayon-v">
                   options
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-v">
                   momentum
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-cn">
                   95
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-115">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-116">
                  <span class="crayon-v">
                   opttheta
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   minFuncSGD
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-sy">
                   @
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   x
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   y
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   z
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   cnnCost
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   x
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   y
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   z
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   numClasses
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   filterDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-117">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   numFilters
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   poolDim
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   theta
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   images
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   labels
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   options
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-118">
                  <span class="crayon-e">
                   save
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-s">
                   'theta.mat'
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-s">
                   'opttheta'
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-119">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-120">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-o">
                   %=
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-121">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-122">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   STEP
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   4
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Test
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-123">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-124">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Test
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   performance
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   of
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   trained
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   model
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   using
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   MNIST
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   test
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   set
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Your
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-125">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-126">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   accuracy
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   should
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   be
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   above
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   97
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   after
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   3
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   epochs
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   of
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   training
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-127">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-128">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-129">
                  <span class="crayon-v">
                   testImages
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   loadMNISTImages
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-s">
                   './common/t10k-images-idx3-ubyte'
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-130">
                  <span class="crayon-v">
                   testImages
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   reshape
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   testImages
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   imageDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   imageDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-sy">
                   [
                  </span>
                  <span class="crayon-sy">
                   ]
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-131">
                  <span class="crayon-v">
                   testLabels
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   loadMNISTLabels
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-s">
                   './common/t10k-labels-idx1-ubyte'
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-132">
                  <span class="crayon-e">
                   testLabels
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   testLabels
                  </span>
                  <span class="crayon-o">
                   ==
                  </span>
                  <span class="crayon-cn">
                   0
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   10
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Remap
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   0
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   to
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   10
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-133">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-134">
                  <span class="crayon-sy">
                   [
                  </span>
                  <span class="crayon-o">
                   ~
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   cost
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   preds
                  </span>
                  <span class="crayon-sy">
                   ]
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-e">
                   cnnCost
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   opttheta
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   testImages
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   testLabels
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   numClasses
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-135">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   filterDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   numFilters
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   poolDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-t">
                   true
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-136">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-137">
                  <span class="crayon-v">
                   acc
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   sum
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   preds
                  </span>
                  <span class="crayon-o">
                   ==
                  </span>
                  <span class="crayon-v">
                   testLabels
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-o">
                   /
                  </span>
                  <span class="crayon-e">
                   length
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   preds
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-138">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-139">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Accuracy
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   should
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   be
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   around
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   97.4
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   after
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   3
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   epochs
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007c8176648146-140">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007c8176648146-141">
                  <span class="crayon-e">
                   fprintf
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-s">
                   'Accuracy is %f\n'
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   acc
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                </div>
               </td>
              </tr>
             </tbody>
            </table>
           </div>
          </div>
          <!-- [Format Time: 0.2160 seconds] -->
          <p>
          </p>
          <div class="cnblogs_code_toolbar">
           <span class="cnblogs_code_copy">
            <p title="复制代码">
             <img src="http://dataunion.org/wp-content/uploads/2014/12/copycode3.gif"/>
            </p>
           </span>
          </div>
         </div>
         <p>
         </p>
         <p>
          <em>
           <strong>
            cnnConvolve.m:
           </strong>
          </em>
          <em>
           <strong>
           </strong>
          </em>
         </p>
         <div class="cnblogs_code">
          <div class="cnblogs_code_toolbar">
           <span class="cnblogs_code_copy">
            <p title="复制代码">
             <img src="http://dataunion.org/wp-content/uploads/2014/12/copycode3.gif"/>
            </p>
           </span>
          </div>
          <p>
          </p>
          <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
          <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-576852be007de936940218" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
           <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
            <span class="crayon-title">
            </span>
            <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
             <span class="crayon-mixed-highlight" title="含多种语言">
             </span>
             <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
              <div class="crayon-button-icon">
              </div>
             </div>
             <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
              <div class="crayon-button-icon">
              </div>
             </div>
             <div class="crayon-button crayon-wrap-button" title="切换自动换行">
              <div class="crayon-button-icon">
              </div>
             </div>
             <div class="crayon-button crayon-expand-button" title="点击展开代码">
              <div class="crayon-button-icon">
              </div>
             </div>
             <div class="crayon-button crayon-copy-button" title="复制代码">
              <div class="crayon-button-icon">
              </div>
             </div>
             <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
              <div class="crayon-button-icon">
              </div>
             </div>
            </div>
           </div>
           <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
           </div>
           <div class="crayon-plain-wrap">
            <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
             function convolvedFeatures = cnnConvolve(filterDim, numFilters, images, W, b)
%cnnConvolve Returns the convolution of the features given by W and b with
%the given images
%
% Parameters:
%  filterDim - filter (feature) dimension
%  numFilters - number of feature maps
%  images - large images to convolve with, matrix in the form
%           images(r, c, image number)
%  W, b - W, b for features from the sparse autoencoder,传进来的w已经是矩阵的形式
%         W is of shape (filterDim,filterDim,numFilters)
%         b is of shape (numFilters,1)
%
% Returns:
%  convolvedFeatures - matrix of convolved features in the form
%                      convolvedFeatures(imageRow, imageCol, featureNum, imageNum)

numImages = size(images, 3);
imageDim = size(images, 1);
convDim = imageDim - filterDim + 1;

convolvedFeatures = zeros(convDim, convDim, numFilters, numImages);

% Instructions:
%   Convolve every filter with every image here to produce the 
%   (imageDim - filterDim + 1) x (imageDim - filterDim + 1) x numFeatures x numImages
%   matrix convolvedFeatures, such that 
%   convolvedFeatures(imageRow, imageCol, featureNum, imageNum) is the
%   value of the convolved featureNum feature for the imageNum image over
%   the region (imageRow, imageCol) to (imageRow + filterDim - 1, imageCol + filterDim - 1)
%
% Expected running times: 
%   Convolving with 100 images should take less than 30 seconds 
%   Convolving with 5000 images should take around 2 minutes
%   (So to save time when testing, you should convolve with less images, as
%   described earlier)


for imageNum = 1:numImages
  for filterNum = 1:numFilters

    % convolution of image with feature matrix
    convolvedImage = zeros(convDim, convDim);

    % Obtain the feature (filterDim x filterDim) needed during the convolution

    %%% YOUR CODE HERE %%%
    filter = W(:,:,filterNum);
    bc = b(filterNum);
    
    % Flip the feature matrix because of the definition of convolution, as explained later
    filter = rot90(squeeze(filter),2);
      
    % Obtain the image
    im = squeeze(images(:, :, imageNum));

    % Convolve "filter" with "im", adding the result to convolvedImage
    % be sure to do a 'valid' convolution

    %%% YOUR CODE HERE %%%
    convolvedImage = conv2(im, filter, 'valid');
    
    % Add the bias unit
    % Then, apply the sigmoid function to get the hidden activation
    %%% YOUR CODE HERE %%%
    convolvedImage = sigmoid(convolvedImage+bc);
    
    convolvedFeatures(:, :, filterNum, imageNum) = convolvedImage;
  end
end

end

function sigm = sigmoid(x)
    sigm = 1./(1+exp(-x));
end
            </textarea>
           </div>
           <div class="crayon-main" style="">
            <table class="crayon-table">
             <tbody>
              <tr class="crayon-row">
               <td class="crayon-nums " data-settings="show">
                <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                 <div class="crayon-num" data-line="crayon-576852be007de936940218-1">
                  1
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007de936940218-2">
                  2
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007de936940218-3">
                  3
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007de936940218-4">
                  4
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007de936940218-5">
                  5
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007de936940218-6">
                  6
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007de936940218-7">
                  7
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007de936940218-8">
                  8
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007de936940218-9">
                  9
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007de936940218-10">
                  10
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007de936940218-11">
                  11
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007de936940218-12">
                  12
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007de936940218-13">
                  13
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007de936940218-14">
                  14
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007de936940218-15">
                  15
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007de936940218-16">
                  16
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007de936940218-17">
                  17
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007de936940218-18">
                  18
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007de936940218-19">
                  19
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007de936940218-20">
                  20
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007de936940218-21">
                  21
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007de936940218-22">
                  22
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007de936940218-23">
                  23
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007de936940218-24">
                  24
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007de936940218-25">
                  25
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007de936940218-26">
                  26
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007de936940218-27">
                  27
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007de936940218-28">
                  28
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007de936940218-29">
                  29
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007de936940218-30">
                  30
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007de936940218-31">
                  31
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007de936940218-32">
                  32
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007de936940218-33">
                  33
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007de936940218-34">
                  34
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007de936940218-35">
                  35
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007de936940218-36">
                  36
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007de936940218-37">
                  37
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007de936940218-38">
                  38
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007de936940218-39">
                  39
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007de936940218-40">
                  40
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007de936940218-41">
                  41
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007de936940218-42">
                  42
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007de936940218-43">
                  43
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007de936940218-44">
                  44
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007de936940218-45">
                  45
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007de936940218-46">
                  46
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007de936940218-47">
                  47
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007de936940218-48">
                  48
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007de936940218-49">
                  49
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007de936940218-50">
                  50
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007de936940218-51">
                  51
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007de936940218-52">
                  52
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007de936940218-53">
                  53
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007de936940218-54">
                  54
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007de936940218-55">
                  55
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007de936940218-56">
                  56
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007de936940218-57">
                  57
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007de936940218-58">
                  58
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007de936940218-59">
                  59
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007de936940218-60">
                  60
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007de936940218-61">
                  61
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007de936940218-62">
                  62
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007de936940218-63">
                  63
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007de936940218-64">
                  64
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007de936940218-65">
                  65
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007de936940218-66">
                  66
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007de936940218-67">
                  67
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007de936940218-68">
                  68
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007de936940218-69">
                  69
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007de936940218-70">
                  70
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007de936940218-71">
                  71
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007de936940218-72">
                  72
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007de936940218-73">
                  73
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007de936940218-74">
                  74
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007de936940218-75">
                  75
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007de936940218-76">
                  76
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007de936940218-77">
                  77
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007de936940218-78">
                  78
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007de936940218-79">
                  79
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007de936940218-80">
                  80
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007de936940218-81">
                  81
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007de936940218-82">
                  82
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007de936940218-83">
                  83
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007de936940218-84">
                  84
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007de936940218-85">
                  85
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007de936940218-86">
                  86
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007de936940218-87">
                  87
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007de936940218-88">
                  88
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007de936940218-89">
                  89
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007de936940218-90">
                  90
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007de936940218-91">
                  91
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007de936940218-92">
                  92
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007de936940218-93">
                  93
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007de936940218-94">
                  94
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007de936940218-95">
                  95
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007de936940218-96">
                  96
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007de936940218-97">
                  97
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007de936940218-98">
                  98
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007de936940218-99">
                  99
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007de936940218-100">
                  100
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007de936940218-101">
                  101
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007de936940218-102">
                  102
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007de936940218-103">
                  103
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007de936940218-104">
                  104
                 </div>
                </div>
               </td>
               <td class="crayon-code">
                <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                 <div class="crayon-line" id="crayon-576852be007de936940218-1">
                  <span class="crayon-t">
                   function
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   convolvedFeatures
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   cnnConvolve
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   filterDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   numFilters
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   images
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   W
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   b
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007de936940218-2">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-i">
                   cnnConvolve
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Returns
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   convolution
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   of
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   features
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   given
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   by
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   W
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   and
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   b
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   with
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007de936940218-3">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007de936940218-4">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   given
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   images
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007de936940218-5">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007de936940218-6">
                  <span class="crayon-ta">
                   %
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007de936940218-7">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007de936940218-8">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   Parameters
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007de936940218-9">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007de936940218-10">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   filterDim
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   filter
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   feature
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   dimension
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007de936940218-11">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007de936940218-12">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   numFilters
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   number
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   of
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   feature
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   maps
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007de936940218-13">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007de936940218-14">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   images
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   large
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   images
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   to
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   convolve
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   with
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   matrix
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   in
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   form
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007de936940218-15">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007de936940218-16">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   images
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   r
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   c
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   image
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   number
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007de936940218-17">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007de936940218-18">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   W
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   b
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   W
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   b
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   for
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   features
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   from
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   sparse
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   autoencoder
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  传进来的
                  <span class="crayon-i">
                   w
                  </span>
                  已经是矩阵的形式
                 </div>
                 <div class="crayon-line" id="crayon-576852be007de936940218-19">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007de936940218-20">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   W
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   is
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   of
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   shape
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   filterDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   filterDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   numFilters
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007de936940218-21">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007de936940218-22">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   b
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   is
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   of
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   shape
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   numFilters
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007de936940218-23">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007de936940218-24">
                  <span class="crayon-ta">
                   %
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007de936940218-25">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007de936940218-26">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   Returns
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007de936940218-27">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007de936940218-28">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   convolvedFeatures
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   matrix
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   of
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   convolved
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   features
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   in
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   form
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007de936940218-29">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007de936940218-30">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   convolvedFeatures
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   imageRow
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   imageCol
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   featureNum
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   imageNum
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007de936940218-31">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007de936940218-32">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007de936940218-33">
                  <span class="crayon-v">
                   numImages
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   size
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   images
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   3
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007de936940218-34">
                  <span class="crayon-v">
                   imageDim
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   size
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   images
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007de936940218-35">
                  <span class="crayon-v">
                   convDim
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   imageDim
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   filterDim
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   +
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007de936940218-36">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007de936940218-37">
                  <span class="crayon-v">
                   convolvedFeatures
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   zeros
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   convDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   convDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   numFilters
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   numImages
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007de936940218-38">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007de936940218-39">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   Instructions
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007de936940218-40">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007de936940218-41">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Convolve
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   every
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   filter
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   with
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   every
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   image
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   here
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   to
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   produce
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007de936940218-42">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007de936940218-43">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   imageDim
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   filterDim
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   +
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   x
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   imageDim
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   filterDim
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   +
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   x
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   numFeatures
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   x
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   numImages
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007de936940218-44">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007de936940218-45">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   matrix
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   convolvedFeatures
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   such
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   that
                  </span>
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007de936940218-46">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007de936940218-47">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   convolvedFeatures
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   imageRow
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   imageCol
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   featureNum
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   imageNum
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   is
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007de936940218-48">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007de936940218-49">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   value
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   of
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   convolved
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   featureNum
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   feature
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   for
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   imageNum
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   image
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   over
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007de936940218-50">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007de936940218-51">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   region
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   imageRow
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   imageCol
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   to
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   imageRow
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   +
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   filterDim
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   imageCol
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   +
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   filterDim
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007de936940218-52">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007de936940218-53">
                  <span class="crayon-ta">
                   %
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007de936940218-54">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007de936940218-55">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Expected
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   running
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   times
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007de936940218-56">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007de936940218-57">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Convolving
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   with
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   100
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   images
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   should
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   take
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   less
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   than
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   30
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   seconds
                  </span>
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007de936940218-58">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007de936940218-59">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Convolving
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   with
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   5000
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   images
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   should
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   take
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   around
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   2
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   minutes
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007de936940218-60">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007de936940218-61">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-i">
                   So
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   to
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   save
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-t">
                   time
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   when
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   testing
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   you
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   should
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   convolve
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   with
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   less
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   images
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   as
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007de936940218-62">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007de936940218-63">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   described
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   earlier
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007de936940218-64">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007de936940218-65">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007de936940218-66">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007de936940218-67">
                  <span class="crayon-st">
                   for
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   imageNum
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-e">
                   numImages
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007de936940218-68">
                  <span class="crayon-e">
                  </span>
                  <span class="crayon-st">
                   for
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   filterNum
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-v">
                   numFilters
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007de936940218-69">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007de936940218-70">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   convolution
                  </span>
                  <span class="crayon-e">
                   of
                  </span>
                  <span class="crayon-e">
                   image
                  </span>
                  <span class="crayon-e">
                   with
                  </span>
                  <span class="crayon-e">
                   feature
                  </span>
                  <span class="crayon-e">
                   matrix
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007de936940218-71">
                  <span class="crayon-e">
                  </span>
                  <span class="crayon-v">
                   convolvedImage
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   zeros
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   convDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   convDim
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007de936940218-72">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007de936940218-73">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   Obtain
                  </span>
                  <span class="crayon-e">
                   the
                  </span>
                  <span class="crayon-e">
                   feature
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-i">
                   filterDim
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   x
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   filterDim
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   needed
                  </span>
                  <span class="crayon-e">
                   during
                  </span>
                  <span class="crayon-e">
                   the
                  </span>
                  <span class="crayon-v">
                   convolution
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007de936940218-74">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007de936940218-75">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   YOUR
                  </span>
                  <span class="crayon-e">
                   CODE
                  </span>
                  <span class="crayon-v">
                   HERE
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007de936940218-76">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   filter
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   W
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   filterNum
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007de936940218-77">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   bc
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   b
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   filterNum
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007de936940218-78">
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007de936940218-79">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   Flip
                  </span>
                  <span class="crayon-e">
                   the
                  </span>
                  <span class="crayon-e">
                   feature
                  </span>
                  <span class="crayon-e">
                   matrix
                  </span>
                  <span class="crayon-e">
                   because
                  </span>
                  <span class="crayon-e">
                   of
                  </span>
                  <span class="crayon-e">
                   the
                  </span>
                  <span class="crayon-e">
                   definition
                  </span>
                  <span class="crayon-e">
                   of
                  </span>
                  <span class="crayon-v">
                   convolution
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   as
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   explained
                  </span>
                  <span class="crayon-e">
                   later
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007de936940218-80">
                  <span class="crayon-e">
                  </span>
                  <span class="crayon-v">
                   filter
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   rot90
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-e">
                   squeeze
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   filter
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-cn">
                   2
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007de936940218-81">
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007de936940218-82">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   Obtain
                  </span>
                  <span class="crayon-e">
                   the
                  </span>
                  <span class="crayon-e">
                   image
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007de936940218-83">
                  <span class="crayon-e">
                  </span>
                  <span class="crayon-v">
                   im
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   squeeze
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-e">
                   images
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   imageNum
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007de936940218-84">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007de936940218-85">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Convolve
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-s">
                   "filter"
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   with
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-s">
                   "im"
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   adding
                  </span>
                  <span class="crayon-e">
                   the
                  </span>
                  <span class="crayon-e">
                   result
                  </span>
                  <span class="crayon-st">
                   to
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   convolvedImage
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007de936940218-86">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   be
                  </span>
                  <span class="crayon-e">
                   sure
                  </span>
                  <span class="crayon-st">
                   to
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   do
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   a
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-s">
                   'valid'
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   convolution
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007de936940218-87">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007de936940218-88">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   YOUR
                  </span>
                  <span class="crayon-e">
                   CODE
                  </span>
                  <span class="crayon-v">
                   HERE
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007de936940218-89">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   convolvedImage
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   conv2
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   im
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   filter
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-s">
                   'valid'
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007de936940218-90">
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007de936940218-91">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   Add
                  </span>
                  <span class="crayon-e">
                   the
                  </span>
                  <span class="crayon-e">
                   bias
                  </span>
                  <span class="crayon-v">
                   unit
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007de936940218-92">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   Then
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   apply
                  </span>
                  <span class="crayon-e">
                   the
                  </span>
                  <span class="crayon-e">
                   sigmoid
                  </span>
                  <span class="crayon-t">
                   function
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   to
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   get
                  </span>
                  <span class="crayon-e">
                   the
                  </span>
                  <span class="crayon-e">
                   hidden
                  </span>
                  <span class="crayon-v">
                   activation
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007de936940218-93">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   YOUR
                  </span>
                  <span class="crayon-e">
                   CODE
                  </span>
                  <span class="crayon-v">
                   HERE
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007de936940218-94">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   convolvedImage
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   sigmoid
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   convolvedImage
                  </span>
                  <span class="crayon-o">
                   +
                  </span>
                  <span class="crayon-v">
                   bc
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007de936940218-95">
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007de936940218-96">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   convolvedFeatures
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   filterNum
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   imageNum
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   convolvedImage
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007de936940218-97">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   end
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007de936940218-98">
                  <span class="crayon-st">
                   end
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007de936940218-99">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007de936940218-100">
                  <span class="crayon-st">
                   end
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007de936940218-101">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007de936940218-102">
                  <span class="crayon-t">
                   function
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   sigm
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   sigmoid
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   x
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007de936940218-103">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   sigm
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   1.
                  </span>
                  <span class="crayon-o">
                   /
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-o">
                   +
                  </span>
                  <span class="crayon-e">
                   exp
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-v">
                   x
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007de936940218-104">
                  <span class="crayon-st">
                   end
                  </span>
                 </div>
                </div>
               </td>
              </tr>
             </tbody>
            </table>
           </div>
          </div>
          <!-- [Format Time: 0.1318 seconds] -->
          <p>
          </p>
          <div class="cnblogs_code_toolbar">
           <span class="cnblogs_code_copy">
            <p title="复制代码">
             <img src="http://dataunion.org/wp-content/uploads/2014/12/copycode3.gif"/>
            </p>
           </span>
          </div>
         </div>
         <p>
         </p>
         <p>
          <em>
           <strong>
            cnnPool.m:
           </strong>
          </em>
          <em>
           <strong>
           </strong>
          </em>
         </p>
         <div class="cnblogs_code">
          <div class="cnblogs_code_toolbar">
           <span class="cnblogs_code_copy">
            <p title="复制代码">
             <img src="http://dataunion.org/wp-content/uploads/2014/12/copycode3.gif"/>
            </p>
           </span>
          </div>
          <p>
          </p>
          <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
          <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-576852be007e8795412171" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
           <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
            <span class="crayon-title">
            </span>
            <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
             <span class="crayon-mixed-highlight" title="含多种语言">
             </span>
             <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
              <div class="crayon-button-icon">
              </div>
             </div>
             <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
              <div class="crayon-button-icon">
              </div>
             </div>
             <div class="crayon-button crayon-wrap-button" title="切换自动换行">
              <div class="crayon-button-icon">
              </div>
             </div>
             <div class="crayon-button crayon-expand-button" title="点击展开代码">
              <div class="crayon-button-icon">
              </div>
             </div>
             <div class="crayon-button crayon-copy-button" title="复制代码">
              <div class="crayon-button-icon">
              </div>
             </div>
             <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
              <div class="crayon-button-icon">
              </div>
             </div>
            </div>
           </div>
           <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
           </div>
           <div class="crayon-plain-wrap">
            <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
             function pooledFeatures = cnnPool(poolDim, convolvedFeatures)
%cnnPool Pools the given convolved features
%
% Parameters:
%  poolDim - dimension of pooling region
%  convolvedFeatures - convolved features to pool (as given by cnnConvolve)
%                      convolvedFeatures(imageRow, imageCol, featureNum, imageNum)
%
% Returns:
%  pooledFeatures - matrix of pooled features in the form
%                   pooledFeatures(poolRow, poolCol, featureNum, imageNum)
%     

numImages = size(convolvedFeatures, 4);
numFilters = size(convolvedFeatures, 3);
convolvedDim = size(convolvedFeatures, 1);

pooledFeatures = zeros(convolvedDim / poolDim, ...
        convolvedDim / poolDim, numFilters, numImages);

% Instructions:
%   Now pool the convolved features in regions of poolDim x poolDim,
%   to obtain the 
%   (convolvedDim/poolDim) x (convolvedDim/poolDim) x numFeatures x numImages 
%   matrix pooledFeatures, such that
%   pooledFeatures(poolRow, poolCol, featureNum, imageNum) is the 
%   value of the featureNum feature for the imageNum image pooled over the
%   corresponding (poolRow, poolCol) pooling region. 
%   
%   Use mean pooling here.

%%% YOUR CODE HERE %%%
    % convolvedFeatures(imageRow, imageCol, featureNum, imageNum)
    % pooledFeatures(poolRow, poolCol, featureNum, imageNum)
    for numImage = 1:numImages
        for numFeature = 1:numFilters
            for poolRow = 1:convolvedDim / poolDim
                offsetRow = 1+(poolRow-1)*poolDim;
                for poolCol = 1:convolvedDim / poolDim
                    offsetCol = 1+(poolCol-1)*poolDim;
                    patch = convolvedFeatures(offsetRow:offsetRow+poolDim-1, ...
                        offsetCol:offsetCol+poolDim-1,numFeature,numImage); %取出一个patch
                    pooledFeatures(poolRow,poolCol,numFeature,numImage) = mean(patch(:));
                end
            end            
        end
    end
    
end
            </textarea>
           </div>
           <div class="crayon-main" style="">
            <table class="crayon-table">
             <tbody>
              <tr class="crayon-row">
               <td class="crayon-nums " data-settings="show">
                <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                 <div class="crayon-num" data-line="crayon-576852be007e8795412171-1">
                  1
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007e8795412171-2">
                  2
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007e8795412171-3">
                  3
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007e8795412171-4">
                  4
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007e8795412171-5">
                  5
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007e8795412171-6">
                  6
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007e8795412171-7">
                  7
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007e8795412171-8">
                  8
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007e8795412171-9">
                  9
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007e8795412171-10">
                  10
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007e8795412171-11">
                  11
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007e8795412171-12">
                  12
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007e8795412171-13">
                  13
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007e8795412171-14">
                  14
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007e8795412171-15">
                  15
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007e8795412171-16">
                  16
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007e8795412171-17">
                  17
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007e8795412171-18">
                  18
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007e8795412171-19">
                  19
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007e8795412171-20">
                  20
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007e8795412171-21">
                  21
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007e8795412171-22">
                  22
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007e8795412171-23">
                  23
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007e8795412171-24">
                  24
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007e8795412171-25">
                  25
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007e8795412171-26">
                  26
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007e8795412171-27">
                  27
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007e8795412171-28">
                  28
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007e8795412171-29">
                  29
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007e8795412171-30">
                  30
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007e8795412171-31">
                  31
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007e8795412171-32">
                  32
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007e8795412171-33">
                  33
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007e8795412171-34">
                  34
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007e8795412171-35">
                  35
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007e8795412171-36">
                  36
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007e8795412171-37">
                  37
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007e8795412171-38">
                  38
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007e8795412171-39">
                  39
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007e8795412171-40">
                  40
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007e8795412171-41">
                  41
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007e8795412171-42">
                  42
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007e8795412171-43">
                  43
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007e8795412171-44">
                  44
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007e8795412171-45">
                  45
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007e8795412171-46">
                  46
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007e8795412171-47">
                  47
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007e8795412171-48">
                  48
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007e8795412171-49">
                  49
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007e8795412171-50">
                  50
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007e8795412171-51">
                  51
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007e8795412171-52">
                  52
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007e8795412171-53">
                  53
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007e8795412171-54">
                  54
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007e8795412171-55">
                  55
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007e8795412171-56">
                  56
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007e8795412171-57">
                  57
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007e8795412171-58">
                  58
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007e8795412171-59">
                  59
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007e8795412171-60">
                  60
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007e8795412171-61">
                  61
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007e8795412171-62">
                  62
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007e8795412171-63">
                  63
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007e8795412171-64">
                  64
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007e8795412171-65">
                  65
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007e8795412171-66">
                  66
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007e8795412171-67">
                  67
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007e8795412171-68">
                  68
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007e8795412171-69">
                  69
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007e8795412171-70">
                  70
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007e8795412171-71">
                  71
                 </div>
                </div>
               </td>
               <td class="crayon-code">
                <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                 <div class="crayon-line" id="crayon-576852be007e8795412171-1">
                  <span class="crayon-t">
                   function
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   pooledFeatures
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   cnnPool
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   poolDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   convolvedFeatures
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007e8795412171-2">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-i">
                   cnnPool
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Pools
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   given
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   convolved
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   features
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007e8795412171-3">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007e8795412171-4">
                  <span class="crayon-ta">
                   %
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007e8795412171-5">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007e8795412171-6">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   Parameters
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007e8795412171-7">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007e8795412171-8">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   poolDim
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   dimension
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   of
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   pooling
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   region
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007e8795412171-9">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007e8795412171-10">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   convolvedFeatures
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   convolved
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   features
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   to
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   pool
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-i">
                   as
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   given
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   by
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   cnnConvolve
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007e8795412171-11">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007e8795412171-12">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   convolvedFeatures
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   imageRow
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   imageCol
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   featureNum
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   imageNum
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007e8795412171-13">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007e8795412171-14">
                  <span class="crayon-ta">
                   %
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007e8795412171-15">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007e8795412171-16">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   Returns
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007e8795412171-17">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007e8795412171-18">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   pooledFeatures
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   matrix
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   of
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   pooled
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   features
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   in
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   form
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007e8795412171-19">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007e8795412171-20">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   pooledFeatures
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   poolRow
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   poolCol
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   featureNum
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   imageNum
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007e8795412171-21">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007e8795412171-22">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007e8795412171-23">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007e8795412171-24">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007e8795412171-25">
                  <span class="crayon-v">
                   numImages
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   size
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   convolvedFeatures
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   4
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007e8795412171-26">
                  <span class="crayon-v">
                   numFilters
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   size
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   convolvedFeatures
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   3
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007e8795412171-27">
                  <span class="crayon-v">
                   convolvedDim
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   size
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   convolvedFeatures
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007e8795412171-28">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007e8795412171-29">
                  <span class="crayon-v">
                   pooledFeatures
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   zeros
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   convolvedDim
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   /
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   poolDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007e8795412171-30">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   convolvedDim
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   /
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   poolDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   numFilters
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   numImages
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007e8795412171-31">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007e8795412171-32">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   Instructions
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007e8795412171-33">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007e8795412171-34">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Now
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   pool
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   convolved
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   features
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   in
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   regions
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   of
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   poolDim
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   x
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   poolDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007e8795412171-35">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007e8795412171-36">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   to
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   obtain
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007e8795412171-37">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007e8795412171-38">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   convolvedDim
                  </span>
                  <span class="crayon-o">
                   /
                  </span>
                  <span class="crayon-v">
                   poolDim
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   x
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   convolvedDim
                  </span>
                  <span class="crayon-o">
                   /
                  </span>
                  <span class="crayon-v">
                   poolDim
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   x
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   numFeatures
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   x
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   numImages
                  </span>
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007e8795412171-39">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007e8795412171-40">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   matrix
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   pooledFeatures
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   such
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   that
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007e8795412171-41">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007e8795412171-42">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   pooledFeatures
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   poolRow
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   poolCol
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   featureNum
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   imageNum
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   is
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007e8795412171-43">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007e8795412171-44">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   value
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   of
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   featureNum
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   feature
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   for
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   imageNum
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   image
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   pooled
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   over
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007e8795412171-45">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007e8795412171-46">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   corresponding
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   poolRow
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   poolCol
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   pooling
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   region
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007e8795412171-47">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007e8795412171-48">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007e8795412171-49">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007e8795412171-50">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Use
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   mean
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   pooling
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   here
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007e8795412171-51">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007e8795412171-52">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007e8795412171-53">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   YOUR
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   CODE
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   HERE
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007e8795412171-54">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007e8795412171-55">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   convolvedFeatures
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   imageRow
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   imageCol
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   featureNum
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   imageNum
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007e8795412171-56">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   pooledFeatures
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   poolRow
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   poolCol
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   featureNum
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   imageNum
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007e8795412171-57">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   for
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   numImage
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-e">
                   numImages
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007e8795412171-58">
                  <span class="crayon-e">
                  </span>
                  <span class="crayon-st">
                   for
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   numFeature
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-e">
                   numFilters
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007e8795412171-59">
                  <span class="crayon-e">
                  </span>
                  <span class="crayon-st">
                   for
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   poolRow
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-v">
                   convolvedDim
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   /
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   poolDim
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007e8795412171-60">
                  <span class="crayon-e">
                  </span>
                  <span class="crayon-v">
                   offsetRow
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-o">
                   +
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   poolRow
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-o">
                   *
                  </span>
                  <span class="crayon-v">
                   poolDim
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007e8795412171-61">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   for
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   poolCol
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-v">
                   convolvedDim
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   /
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   poolDim
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007e8795412171-62">
                  <span class="crayon-e">
                  </span>
                  <span class="crayon-v">
                   offsetCol
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-o">
                   +
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   poolCol
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-o">
                   *
                  </span>
                  <span class="crayon-v">
                   poolDim
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007e8795412171-63">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   patch
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   convolvedFeatures
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   offsetRow
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-v">
                   offsetRow
                  </span>
                  <span class="crayon-o">
                   +
                  </span>
                  <span class="crayon-v">
                   poolDim
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007e8795412171-64">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   offsetCol
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-v">
                   offsetCol
                  </span>
                  <span class="crayon-o">
                   +
                  </span>
                  <span class="crayon-v">
                   poolDim
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   numFeature
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   numImage
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  取出一个
                  <span class="crayon-e">
                   patch
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007e8795412171-65">
                  <span class="crayon-e">
                  </span>
                  <span class="crayon-e">
                   pooledFeatures
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   poolRow
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   poolCol
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   numFeature
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   numImage
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   mean
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-e">
                   patch
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007e8795412171-66">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   end
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007e8795412171-67">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   end
                  </span>
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007e8795412171-68">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   end
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007e8795412171-69">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   end
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007e8795412171-70">
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007e8795412171-71">
                  <span class="crayon-st">
                   end
                  </span>
                 </div>
                </div>
               </td>
              </tr>
             </tbody>
            </table>
           </div>
          </div>
          <!-- [Format Time: 0.0754 seconds] -->
          <p>
          </p>
          <div class="cnblogs_code_toolbar">
           <span class="cnblogs_code_copy">
            <p title="复制代码">
             <img src="http://dataunion.org/wp-content/uploads/2014/12/copycode3.gif"/>
            </p>
           </span>
          </div>
         </div>
         <p>
         </p>
         <p>
          <em>
           <strong>
            cnnCost.m:
           </strong>
          </em>
         </p>
         <div class="cnblogs_code">
          <div class="cnblogs_code_toolbar">
           <span class="cnblogs_code_copy">
            <p title="复制代码">
             <img src="http://dataunion.org/wp-content/uploads/2014/12/copycode3.gif"/>
            </p>
           </span>
          </div>
          <p>
          </p>
          <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
          <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-576852be007f1755638580" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
           <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
            <span class="crayon-title">
            </span>
            <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
             <span class="crayon-mixed-highlight" title="含多种语言">
             </span>
             <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
              <div class="crayon-button-icon">
              </div>
             </div>
             <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
              <div class="crayon-button-icon">
              </div>
             </div>
             <div class="crayon-button crayon-wrap-button" title="切换自动换行">
              <div class="crayon-button-icon">
              </div>
             </div>
             <div class="crayon-button crayon-expand-button" title="点击展开代码">
              <div class="crayon-button-icon">
              </div>
             </div>
             <div class="crayon-button crayon-copy-button" title="复制代码">
              <div class="crayon-button-icon">
              </div>
             </div>
             <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
              <div class="crayon-button-icon">
              </div>
             </div>
            </div>
           </div>
           <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
           </div>
           <div class="crayon-plain-wrap">
            <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
             function [cost, grad, preds] = cnnCost(theta,images,labels,numClasses,...
                                filterDim,numFilters,poolDim,pred)
% Calcualte cost and gradient for a single layer convolutional
% neural network followed by a softmax layer with cross entropy
% objective.
%                            
% Parameters:
%  theta      -  unrolled parameter vector
%  images     -  stores images in imageDim x imageDim x numImges
%                array
%  numClasses -  number of classes to predict
%  filterDim  -  dimension of convolutional filter                            
%  numFilters -  number of convolutional filters
%  poolDim    -  dimension of pooling area
%  pred       -  boolean only forward propagate and return
%                predictions
%
%
% Returns:
%  cost       -  cross entropy cost
%  grad       -  gradient with respect to theta (if pred==False)
%  preds      -  list of predictions for each example (if pred==True)


if ~exist('pred','var')
    pred = false;
end;


imageDim = size(images,1); % height/width of image
numImages = size(images,3); % number of images
lambda = 3e-3; % weight decay parameter     

%% Reshape parameters and setup gradient matrices

% Wc is filterDim x filterDim x numFilters parameter matrix
% bc is the corresponding bias

% Wd is numClasses x hiddenSize parameter matrix where hiddenSize
% is the number of output units from the convolutional layer
% bd is corresponding bias
[Wc, Wd, bc, bd] = cnnParamsToStack(theta,imageDim,filterDim,numFilters,...
                        poolDim,numClasses); %the theta vector cosists wc,wd,bc,bd in order

% Same sizes as Wc,Wd,bc,bd. Used to hold gradient w.r.t above params.
Wc_grad = zeros(size(Wc));
Wd_grad = zeros(size(Wd));
bc_grad = zeros(size(bc));
bd_grad = zeros(size(bd));

%%======================================================================
%% STEP 1a: Forward Propagation
%  In this step you will forward propagate the input through the
%  convolutional and subsampling (mean pooling) layers.  You will then use
%  the responses from the convolution and pooling layer as the input to a
%  standard softmax layer.

%% Convolutional Layer
%  For each image and each filter, convolve the image with the filter, add
%  the bias and apply the sigmoid nonlinearity.  Then subsample the 
%  convolved activations with mean pooling.  Store the results of the
%  convolution in activations and the results of the pooling in
%  activationsPooled.  You will need to save the convolved activations for
%  backpropagation.
convDim = imageDim-filterDim+1; % dimension of convolved output
outputDim = (convDim)/poolDim; % dimension of subsampled output

% convDim x convDim x numFilters x numImages tensor for storing activations
activations = zeros(convDim,convDim,numFilters,numImages);

% outputDim x outputDim x numFilters x numImages tensor for storing
% subsampled activations
activationsPooled = zeros(outputDim,outputDim,numFilters,numImages);

%%% YOUR CODE HERE %%%
convolvedFeatures = cnnConvolve(filterDim, numFilters, images, Wc, bc); %前向传播,已经经过了激发函数
activationsPooled = cnnPool(poolDim, convolvedFeatures);


% Reshape activations into 2-d matrix, hiddenSize x numImages,
% for Softmax layer
activationsPooled = reshape(activationsPooled,[],numImages);

%% Softmax Layer
%  Forward propagate the pooled activations calculated above into a
%  standard softmax layer. For your convenience we have reshaped
%  activationPooled into a hiddenSize x numImages matrix.  Store the
%  results in probs.

% numClasses x numImages for storing probability that each image belongs to
% each class.
probs = zeros(numClasses,numImages);

%%% YOUR CODE HERE %%%
%Wd=(numClasses,hiddenSize),probs的每一列代表一个输出
M = Wd*activationsPooled+repmat(bd,[1,numImages]); 
M = bsxfun(@minus,M,max(M,[],1));
M = exp(M);
probs = bsxfun(@rdivide, M, sum(M)); %why rdivide?

%%======================================================================
%% STEP 1b: Calculate Cost
%  In this step you will use the labels given as input and the probs
%  calculate above to evaluate the cross entropy objective.  Store your
%  results in cost.

cost = 0; % save objective into cost

%%% YOUR CODE HERE %%%
% cost = -1/numImages*labels(:)'*log(probs(:));
% 首先需要把labels弄成one-hot编码
groundTruth = full(sparse(labels, 1:numImages, 1));
cost = -1./numImages*groundTruth(:)'*log(probs(:))+(lambda/2.)*(sum(Wd(:).^2)+sum(Wc(:).^2)); %加入一个惩罚项
% cost = -1./numImages*groundTruth(:)'*log(probs(:));

% Makes predictions given probs and returns without backproagating errors.
if pred
    [~,preds] = max(probs,[],1);
    preds = preds';
    grad = 0;
    return;
end;

%% 将c步和d步合成在一起了
%======================================================================
% STEP 1c: Backpropagation
%  Backpropagate errors through the softmax and convolutional/subsampling
%  layers.  Store the errors for the next step to calculate the gradient.
%  Backpropagating the error w.r.t the softmax layer is as usual.  To
%  backpropagate through the pooling layer, you will need to upsample the
%  error with respect to the pooling layer for each filter and each image.  
%  Use the kron function and a matrix of ones to do this upsampling 
%  quickly.

% STEP 1d: Gradient Calculation
%  After backpropagating the errors above, we can use them to calculate the
%  gradient with respect to all the parameters.  The gradient w.r.t the
%  softmax layer is calculated as usual.  To calculate the gradient w.r.t.
%  a filter in the convolutional layer, convolve the backpropagated error
%  for that filter with each image and aggregate over images.

%%% YOUR CODE HERE %%%
%%% YOUR CODE HERE %%%
% 网络结构: images--&amp;gt; convolvedFeatures--&amp;gt; activationsPooled--&amp;gt; probs
% Wd = (numClasses,hiddenSize)
% bd = (hiddenSize,1)
% Wc = (filterDim,filterDim,numFilters)
% bc = (numFilters,1)
% activationsPooled = zeros(outputDim,outputDim,numFilters,numImages);
% convolvedFeatures = (convDim,convDim,numFilters,numImages)
% images(imageDim,imageDim,numImges)
delta_d = -(groundTruth-probs); % softmax layer's preactivation,每一个样本都对应有自己每层的误差敏感性。
Wd_grad = (1./numImages)*delta_d*activationsPooled'+lambda*Wd;
bd_grad = (1./numImages)*sum(delta_d,2); %注意这里是要求和
delta_s = Wd'*delta_d; %the pooling/sample layer's preactivation
delta_s = reshape(delta_s,outputDim,outputDim,numFilters,numImages);

%进行unsampling操作，由于kron函数只能对二维矩阵操作，所以还得分开弄
%delta_c = convolvedFeatures.*(1-convolvedFeatures).*(1./poolDim^2)*kron(delta_s, ones(poolDim)); 
delta_c = zeros(convDim,convDim,numFilters,numImages);
for i=1:numImages
    for j=1:numFilters
        delta_c(:,:,j,i) = (1./poolDim^2)*kron(squeeze(delta_s(:,:,j,i)), ones(poolDim));
    end
end
delta_c = convolvedFeatures.*(1-convolvedFeatures).*delta_c;

% Wc_grad = convn(images,rot90(delta_c,2,'valid'))+ lambda*Wc;
for i=1:numFilters
    Wc_i = zeros(filterDim,filterDim);
    for j=1:numImages  
        Wc_i = Wc_i+conv2(squeeze(images(:,:,j)),rot90(squeeze(delta_c(:,:,i,j)),2),'valid');
    end
   % Wc_i = convn(images,rot180(squeeze(delta_c(:,:,i,:))),'valid');
    % add penalize
    Wc_grad(:,:,i) = (1./numImages)*Wc_i+lambda*Wc(:,:,i);
    
    bc_i = delta_c(:,:,i,:);
    bc_i = bc_i(:);
    bc_grad(i) = sum(bc_i)/numImages;
end

%% Unroll gradient into grad vector for minFunc
grad = [Wc_grad(:) ; Wd_grad(:) ; bc_grad(:) ; bd_grad(:)];

end

function X = rot180(X)
    X = flipdim(flipdim(X, 1), 2);
end
            </textarea>
           </div>
           <div class="crayon-main" style="">
            <table class="crayon-table">
             <tbody>
              <tr class="crayon-row">
               <td class="crayon-nums " data-settings="show">
                <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-1">
                  1
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-2">
                  2
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-3">
                  3
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-4">
                  4
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-5">
                  5
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-6">
                  6
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-7">
                  7
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-8">
                  8
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-9">
                  9
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-10">
                  10
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-11">
                  11
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-12">
                  12
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-13">
                  13
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-14">
                  14
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-15">
                  15
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-16">
                  16
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-17">
                  17
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-18">
                  18
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-19">
                  19
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-20">
                  20
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-21">
                  21
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-22">
                  22
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-23">
                  23
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-24">
                  24
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-25">
                  25
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-26">
                  26
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-27">
                  27
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-28">
                  28
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-29">
                  29
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-30">
                  30
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-31">
                  31
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-32">
                  32
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-33">
                  33
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-34">
                  34
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-35">
                  35
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-36">
                  36
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-37">
                  37
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-38">
                  38
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-39">
                  39
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-40">
                  40
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-41">
                  41
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-42">
                  42
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-43">
                  43
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-44">
                  44
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-45">
                  45
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-46">
                  46
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-47">
                  47
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-48">
                  48
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-49">
                  49
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-50">
                  50
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-51">
                  51
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-52">
                  52
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-53">
                  53
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-54">
                  54
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-55">
                  55
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-56">
                  56
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-57">
                  57
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-58">
                  58
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-59">
                  59
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-60">
                  60
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-61">
                  61
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-62">
                  62
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-63">
                  63
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-64">
                  64
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-65">
                  65
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-66">
                  66
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-67">
                  67
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-68">
                  68
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-69">
                  69
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-70">
                  70
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-71">
                  71
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-72">
                  72
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-73">
                  73
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-74">
                  74
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-75">
                  75
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-76">
                  76
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-77">
                  77
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-78">
                  78
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-79">
                  79
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-80">
                  80
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-81">
                  81
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-82">
                  82
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-83">
                  83
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-84">
                  84
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-85">
                  85
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-86">
                  86
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-87">
                  87
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-88">
                  88
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-89">
                  89
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-90">
                  90
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-91">
                  91
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-92">
                  92
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-93">
                  93
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-94">
                  94
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-95">
                  95
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-96">
                  96
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-97">
                  97
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-98">
                  98
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-99">
                  99
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-100">
                  100
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-101">
                  101
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-102">
                  102
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-103">
                  103
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-104">
                  104
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-105">
                  105
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-106">
                  106
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-107">
                  107
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-108">
                  108
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-109">
                  109
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-110">
                  110
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-111">
                  111
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-112">
                  112
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-113">
                  113
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-114">
                  114
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-115">
                  115
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-116">
                  116
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-117">
                  117
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-118">
                  118
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-119">
                  119
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-120">
                  120
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-121">
                  121
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-122">
                  122
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-123">
                  123
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-124">
                  124
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-125">
                  125
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-126">
                  126
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-127">
                  127
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-128">
                  128
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-129">
                  129
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-130">
                  130
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-131">
                  131
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-132">
                  132
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-133">
                  133
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-134">
                  134
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-135">
                  135
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-136">
                  136
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-137">
                  137
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-138">
                  138
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-139">
                  139
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-140">
                  140
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-141">
                  141
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-142">
                  142
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-143">
                  143
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-144">
                  144
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-145">
                  145
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-146">
                  146
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-147">
                  147
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-148">
                  148
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-149">
                  149
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-150">
                  150
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-151">
                  151
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-152">
                  152
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-153">
                  153
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-154">
                  154
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-155">
                  155
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-156">
                  156
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-157">
                  157
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-158">
                  158
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-159">
                  159
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-160">
                  160
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-161">
                  161
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-162">
                  162
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-163">
                  163
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-164">
                  164
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-165">
                  165
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-166">
                  166
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-167">
                  167
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-168">
                  168
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-169">
                  169
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-170">
                  170
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-171">
                  171
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-172">
                  172
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-173">
                  173
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-174">
                  174
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-175">
                  175
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-176">
                  176
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-177">
                  177
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-178">
                  178
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-179">
                  179
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-180">
                  180
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-181">
                  181
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-182">
                  182
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-183">
                  183
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-184">
                  184
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-185">
                  185
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-186">
                  186
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-187">
                  187
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-188">
                  188
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-189">
                  189
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-190">
                  190
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-191">
                  191
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-192">
                  192
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-193">
                  193
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-194">
                  194
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-195">
                  195
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-196">
                  196
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-197">
                  197
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-198">
                  198
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-199">
                  199
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-200">
                  200
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-201">
                  201
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-202">
                  202
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-203">
                  203
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-204">
                  204
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-205">
                  205
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-206">
                  206
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-207">
                  207
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-208">
                  208
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-209">
                  209
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-210">
                  210
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-211">
                  211
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-212">
                  212
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-213">
                  213
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-214">
                  214
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-215">
                  215
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-216">
                  216
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-217">
                  217
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-218">
                  218
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-219">
                  219
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-220">
                  220
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-221">
                  221
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-222">
                  222
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-223">
                  223
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-224">
                  224
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-225">
                  225
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-226">
                  226
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-227">
                  227
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-228">
                  228
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-229">
                  229
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-230">
                  230
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-231">
                  231
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-232">
                  232
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-233">
                  233
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-234">
                  234
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-235">
                  235
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-236">
                  236
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-237">
                  237
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-238">
                  238
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-239">
                  239
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-240">
                  240
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-241">
                  241
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-242">
                  242
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-243">
                  243
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-244">
                  244
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-245">
                  245
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-246">
                  246
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-247">
                  247
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-248">
                  248
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-249">
                  249
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-250">
                  250
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-251">
                  251
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-252">
                  252
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-253">
                  253
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-254">
                  254
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-255">
                  255
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-256">
                  256
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-257">
                  257
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-258">
                  258
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-259">
                  259
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-260">
                  260
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-261">
                  261
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-262">
                  262
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-263">
                  263
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-264">
                  264
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-265">
                  265
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-266">
                  266
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-267">
                  267
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-268">
                  268
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-269">
                  269
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-270">
                  270
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-271">
                  271
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-272">
                  272
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-273">
                  273
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-274">
                  274
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-275">
                  275
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-276">
                  276
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-277">
                  277
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-278">
                  278
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-279">
                  279
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-280">
                  280
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-281">
                  281
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-282">
                  282
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-283">
                  283
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007f1755638580-284">
                  284
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007f1755638580-285">
                  285
                 </div>
                </div>
               </td>
               <td class="crayon-code">
                <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                 <div class="crayon-line" id="crayon-576852be007f1755638580-1">
                  <span class="crayon-t">
                   function
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-sy">
                   [
                  </span>
                  <span class="crayon-v">
                   cost
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   grad
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   preds
                  </span>
                  <span class="crayon-sy">
                   ]
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   cnnCost
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   theta
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   images
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   labels
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   numClasses
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-2">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   filterDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   numFilters
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   poolDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   pred
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-3">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Calcualte
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   cost
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   and
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   gradient
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   for
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   a
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   single
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   layer
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   convolutional
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-4">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-5">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   neural
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   network
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   followed
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   by
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   a
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   softmax
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   layer
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   with
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   cross
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   entropy
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-6">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-7">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   objective
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-8">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-9">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-10">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-11">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   Parameters
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-12">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-13">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   theta
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   unrolled
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   parameter
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   vector
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-14">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-15">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   images
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   stores
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   images
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   in
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   imageDim
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   x
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   imageDim
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   x
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   numImges
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-16">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-17">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-t">
                   array
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-18">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-19">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   numClasses
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   number
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   of
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   classes
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   to
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   predict
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-20">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-21">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   filterDim
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   dimension
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   of
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   convolutional
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   filter
                  </span>
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-22">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-23">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   numFilters
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   number
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   of
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   convolutional
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   filters
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-24">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-25">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   poolDim
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   dimension
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   of
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   pooling
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   area
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-26">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-27">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   pred
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   boolean
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   only
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   forward
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   propagate
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   and
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   return
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-28">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-29">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   predictions
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-30">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-31">
                  <span class="crayon-ta">
                   %
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-32">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-33">
                  <span class="crayon-ta">
                   %
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-34">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-35">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   Returns
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-36">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-37">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   cost
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   cross
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   entropy
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   cost
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-38">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-39">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   grad
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   gradient
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   with
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   respect
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   to
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   theta
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-st">
                   if
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   pred
                  </span>
                  <span class="crayon-o">
                   ==
                  </span>
                  <span class="crayon-r">
                   False
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-40">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-41">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   preds
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   list
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   of
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   predictions
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   for
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   each
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   example
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-st">
                   if
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   pred
                  </span>
                  <span class="crayon-o">
                   ==
                  </span>
                  <span class="crayon-r">
                   True
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-42">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-43">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-44">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-45">
                  <span class="crayon-st">
                   if
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   ~
                  </span>
                  <span class="crayon-e">
                   exist
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-s">
                   'pred'
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-s">
                   'var'
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-46">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   pred
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-t">
                   false
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-47">
                  <span class="crayon-st">
                   end
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-48">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-49">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-50">
                  <span class="crayon-v">
                   imageDim
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   size
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   images
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   height
                  </span>
                  <span class="crayon-o">
                   /
                  </span>
                  <span class="crayon-e">
                   width
                  </span>
                  <span class="crayon-e">
                   of
                  </span>
                  <span class="crayon-e">
                   image
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-51">
                  <span class="crayon-v">
                   numImages
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   size
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   images
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-cn">
                   3
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   number
                  </span>
                  <span class="crayon-e">
                   of
                  </span>
                  <span class="crayon-e">
                   images
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-52">
                  <span class="crayon-v">
                   lambda
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   3e
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-cn">
                   3
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   weight
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   decay
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   parameter
                  </span>
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-53">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-54">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Reshape
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   parameters
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   and
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   setup
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   gradient
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   matrices
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-55">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-56">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-57">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Wc
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   is
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   filterDim
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   x
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   filterDim
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   x
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   numFilters
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   parameter
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   matrix
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-58">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-59">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   bc
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   is
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   corresponding
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   bias
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-60">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-61">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-62">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Wd
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   is
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   numClasses
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   x
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   hiddenSize
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   parameter
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   matrix
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   where
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   hiddenSize
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-63">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-64">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   is
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   number
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   of
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   output
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   units
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   from
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   convolutional
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   layer
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-65">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-66">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   bd
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   is
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   corresponding
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   bias
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-67">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-68">
                  <span class="crayon-sy">
                   [
                  </span>
                  <span class="crayon-v">
                   Wc
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   Wd
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   bc
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   bd
                  </span>
                  <span class="crayon-sy">
                   ]
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   cnnParamsToStack
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   theta
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   imageDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   filterDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   numFilters
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-69">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   poolDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   numClasses
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-e">
                   the
                  </span>
                  <span class="crayon-e">
                   theta
                  </span>
                  <span class="crayon-e">
                   vector
                  </span>
                  <span class="crayon-e">
                   cosists
                  </span>
                  <span class="crayon-v">
                   wc
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   wd
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   bc
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-e">
                   bd
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   in
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   order
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-70">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-71">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Same
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   sizes
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   as
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   Wc
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   Wd
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   bc
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   bd
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Used
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   to
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   hold
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   gradient
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   w
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-v">
                   r
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-i">
                   t
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   above
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   params
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-72">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-73">
                  <span class="crayon-v">
                   Wc_grad
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   zeros
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-e">
                   size
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   Wc
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-74">
                  <span class="crayon-v">
                   Wd_grad
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   zeros
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-e">
                   size
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   Wd
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-75">
                  <span class="crayon-v">
                   bc_grad
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   zeros
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-e">
                   size
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   bc
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-76">
                  <span class="crayon-v">
                   bd_grad
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   zeros
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-e">
                   size
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   bd
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-77">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-78">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-o">
                   %=
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-79">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-80">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   STEP
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   1a
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Forward
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Propagation
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-81">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-82">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   In
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   this
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   step
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   you
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   will
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   forward
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   propagate
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   input
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   through
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-83">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-84">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   convolutional
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   and
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   subsampling
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-i">
                   mean
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   pooling
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   layers
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   You
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   will
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   then
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   use
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-85">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-86">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   responses
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   from
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   convolution
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   and
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   pooling
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   layer
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   as
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   input
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   to
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   a
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-87">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-88">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   standard
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   softmax
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   layer
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-89">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-90">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-91">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Convolutional
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Layer
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-92">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-93">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   For
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   each
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   image
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   and
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   each
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   filter
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   convolve
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   image
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   with
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   filter
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   add
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-94">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-95">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   bias
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   and
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   apply
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   sigmoid
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   nonlinearity
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   Then
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   subsample
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-96">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-97">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   convolved
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   activations
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   with
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   mean
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   pooling
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Store
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   results
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   of
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-98">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-99">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   convolution
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   in
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   activations
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   and
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   results
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   of
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   pooling
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   in
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-100">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-101">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   activationsPooled
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   You
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   will
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   need
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   to
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   save
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   convolved
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   activations
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   for
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-102">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-103">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   backpropagation
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-104">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-105">
                  <span class="crayon-v">
                   convDim
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   imageDim
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-v">
                   filterDim
                  </span>
                  <span class="crayon-o">
                   +
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   dimension
                  </span>
                  <span class="crayon-e">
                   of
                  </span>
                  <span class="crayon-e">
                   convolved
                  </span>
                  <span class="crayon-e">
                   output
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-106">
                  <span class="crayon-v">
                   outputDim
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   convDim
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-o">
                   /
                  </span>
                  <span class="crayon-v">
                   poolDim
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   dimension
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   of
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   subsampled
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   output
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-107">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-108">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   convDim
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   x
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   convDim
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   x
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   numFilters
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   x
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   numImages
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   tensor
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   for
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   storing
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   activations
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-109">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-110">
                  <span class="crayon-v">
                   activations
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   zeros
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   convDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   convDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   numFilters
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   numImages
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-111">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-112">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   outputDim
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   x
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   outputDim
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   x
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   numFilters
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   x
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   numImages
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   tensor
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   for
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   storing
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-113">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-114">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   subsampled
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   activations
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-115">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-116">
                  <span class="crayon-v">
                   activationsPooled
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   zeros
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   outputDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   outputDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   numFilters
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   numImages
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-117">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-118">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   YOUR
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   CODE
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   HERE
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-119">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-120">
                  <span class="crayon-v">
                   convolvedFeatures
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   cnnConvolve
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   filterDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   numFilters
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   images
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   Wc
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   bc
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  前向传播
                  <span class="crayon-sy">
                   ,
                  </span>
                  已经经过了激发函数
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-121">
                  <span class="crayon-v">
                   activationsPooled
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   cnnPool
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   poolDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   convolvedFeatures
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-122">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-123">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-124">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Reshape
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   activations
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   into
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   2
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-i">
                   d
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   matrix
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   hiddenSize
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   x
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   numImages
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-125">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-126">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   for
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Softmax
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   layer
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-127">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-128">
                  <span class="crayon-v">
                   activationsPooled
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   reshape
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   activationsPooled
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-sy">
                   [
                  </span>
                  <span class="crayon-sy">
                   ]
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   numImages
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-129">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-130">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Softmax
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Layer
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-131">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-132">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Forward
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   propagate
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   pooled
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   activations
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   calculated
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   above
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   into
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   a
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-133">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-134">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   standard
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   softmax
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   layer
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   For
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   your
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   convenience
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   we
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   have
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   reshaped
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-135">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-136">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   activationPooled
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   into
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   a
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   hiddenSize
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   x
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   numImages
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   matrix
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Store
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-137">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-138">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   results
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   in
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   probs
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-139">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-140">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-141">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   numClasses
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   x
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   numImages
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   for
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   storing
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   probability
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   that
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   each
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   image
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   belongs
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   to
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-142">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-143">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   each
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-r">
                   class
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-144">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-145">
                  <span class="crayon-v">
                   probs
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   zeros
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   numClasses
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   numImages
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-146">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-147">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   YOUR
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   CODE
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   HERE
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-148">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-149">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-v">
                   Wd
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   numClasses
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   hiddenSize
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-i">
                   probs
                  </span>
                  的每一列代表一个输出
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-150">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-151">
                  <span class="crayon-v">
                   M
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e ">
                   Wd*
                  </span>
                  <span class="crayon-v">
                   activationsPooled
                  </span>
                  <span class="crayon-o">
                   +
                  </span>
                  <span class="crayon-e">
                   repmat
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   bd
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-sy">
                   [
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   numImages
                  </span>
                  <span class="crayon-sy">
                   ]
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-152">
                  <span class="crayon-v">
                   M
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   bsxfun
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-sy">
                   @
                  </span>
                  <span class="crayon-v">
                   minus
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   M
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-e">
                   max
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   M
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-sy">
                   [
                  </span>
                  <span class="crayon-sy">
                   ]
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-153">
                  <span class="crayon-v">
                   M
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   exp
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   M
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-154">
                  <span class="crayon-v">
                   probs
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   bsxfun
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-sy">
                   @
                  </span>
                  <span class="crayon-v">
                   rdivide
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   M
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   sum
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   M
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-e">
                   why
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   rdivide
                  </span>
                  <span class="crayon-sy">
                   ?
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-155">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-156">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-o">
                   %=
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-157">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-158">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   STEP
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   1b
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Calculate
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Cost
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-159">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-160">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   In
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   this
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   step
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   you
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   will
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   use
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   labels
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   given
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   as
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   input
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   and
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   probs
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-161">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-162">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   calculate
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   above
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   to
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   evaluate
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   cross
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   entropy
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   objective
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Store
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   your
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-163">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-164">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   results
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   in
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   cost
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-165">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-166">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-167">
                  <span class="crayon-v">
                   cost
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   0
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   save
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   objective
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   into
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   cost
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-168">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-169">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   YOUR
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   CODE
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   HERE
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-170">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-171">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   cost
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-o">
                   /
                  </span>
                  <span class="crayon-v">
                   numImages
                  </span>
                  <span class="crayon-o">
                   *
                  </span>
                  <span class="crayon-e">
                   labels
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  '
                  <span class="crayon-o">
                   *
                  </span>
                  <span class="crayon-e">
                   log
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-e">
                   probs
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-172">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-173">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  首先需要把
                  <span class="crayon-i">
                   labels
                  </span>
                  弄成
                  <span class="crayon-v">
                   one
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-i">
                   hot
                  </span>
                  编码
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-174">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-175">
                  <span class="crayon-v">
                   groundTruth
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   full
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-e">
                   sparse
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   labels
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-v">
                   numImages
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-176">
                  <span class="crayon-v">
                   cost
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-cn">
                   1.
                  </span>
                  <span class="crayon-o">
                   /
                  </span>
                  <span class="crayon-e ">
                   numImages*
                  </span>
                  <span class="crayon-e">
                   groundTruth
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-s">
                   '*log(probs(:))+(lambda/2.)*(sum(Wd(:).^2)+sum(Wc(:).^2)); %加入一个惩罚项
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-177">
                  <span class="crayon-s">
                   <span class="crayon-ta">
                    %
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-v">
                    cost
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-o">
                    =
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-o">
                    -
                   </span>
                   <span class="crayon-cn">
                    1.
                   </span>
                   <span class="crayon-o">
                    /
                   </span>
                   <span class="crayon-v">
                    numImages
                   </span>
                   <span class="crayon-o">
                    *
                   </span>
                   <span class="crayon-e">
                    groundTruth
                   </span>
                   <span class="crayon-sy">
                    (
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-sy">
                    )
                   </span>
                   '
                   <span class="crayon-o">
                    *
                   </span>
                   <span class="crayon-e">
                    log
                   </span>
                   <span class="crayon-sy">
                    (
                   </span>
                   <span class="crayon-e">
                    probs
                   </span>
                   <span class="crayon-sy">
                    (
                   </span>
                   <span class="crayon-o">
                    :
                   </span>
                   <span class="crayon-sy">
                    )
                   </span>
                   <span class="crayon-sy">
                    )
                   </span>
                   <span class="crayon-sy">
                    ;
                   </span>
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-178">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-179">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-180">
                  <span class="crayon-s">
                   <span class="crayon-ta">
                    %
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-i">
                    Makes
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-i">
                    predictions
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-i">
                    given
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-i">
                    probs
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-st">
                    and
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-i">
                    returns
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-i">
                    without
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-i">
                    backproagating
                   </span>
                   <span class="crayon-h">
                   </span>
                   <span class="crayon-v">
                    errors
                   </span>
                   <span class="crayon-sy">
                    .
                   </span>
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-181">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-182">
                  <span class="crayon-s">
                   if pred
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-183">
                  <span class="crayon-s">
                   [~,preds] = max(probs,[],1);
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-184">
                  <span class="crayon-s">
                   preds = preds'
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-185">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   grad
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   0
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-186">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   return
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-187">
                  <span class="crayon-st">
                   end
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-188">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-189">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  将
                  <span class="crayon-i">
                   c
                  </span>
                  步和
                  <span class="crayon-i">
                   d
                  </span>
                  步合成在一起了
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-190">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-191">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-192">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-193">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   STEP
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   1c
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Backpropagation
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-194">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-195">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Backpropagate
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   errors
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   through
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   softmax
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   and
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   convolutional
                  </span>
                  <span class="crayon-o">
                   /
                  </span>
                  <span class="crayon-i">
                   subsampling
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-196">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-197">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   layers
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Store
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   errors
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   for
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   next
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   step
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   to
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   calculate
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   gradient
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-198">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-199">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Backpropagating
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   error
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   w
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-v">
                   r
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-i">
                   t
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   softmax
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   layer
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   is
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   as
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   usual
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   To
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-200">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-201">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   backpropagate
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   through
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   pooling
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   layer
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   you
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   will
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   need
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   to
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   upsample
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-202">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-203">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   error
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   with
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   respect
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   to
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   pooling
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   layer
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   for
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   each
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   filter
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   and
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   each
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   image
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-204">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-205">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Use
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   kron
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   function
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   and
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   a
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   matrix
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   of
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   ones
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   to
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   do
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   this
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   upsampling
                  </span>
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-206">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-207">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   quickly
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-208">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-209">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-210">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   STEP
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   1d
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Gradient
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Calculation
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-211">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-212">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   After
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   backpropagating
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   errors
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   above
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   we
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   can
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   use
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   them
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   to
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   calculate
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-213">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-214">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   gradient
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   with
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   respect
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   to
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   all
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   parameters
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   The
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   gradient
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   w
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-v">
                   r
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-i">
                   t
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-215">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-216">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   softmax
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   layer
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   is
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   calculated
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   as
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   usual
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   To
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   calculate
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   gradient
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   w
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-v">
                   r
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-v">
                   t
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-217">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-218">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   a
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   filter
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   in
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   convolutional
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   layer
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   convolve
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   backpropagated
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   error
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-219">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-220">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   for
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   that
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   filter
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   with
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   each
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   image
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   and
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   aggregate
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   over
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   images
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-221">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-222">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-223">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   YOUR
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   CODE
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   HERE
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-224">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-225">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   YOUR
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   CODE
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   HERE
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-226">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-227">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  网络结构
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   images
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-v">
                   &amp;gt
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   convolvedFeatures
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-v">
                   &amp;gt
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   activationsPooled
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-v">
                   &amp;gt
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   probs
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-228">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-229">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   Wd
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   numClasses
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   hiddenSize
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-230">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-231">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   bd
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   hiddenSize
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-232">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-233">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   Wc
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   filterDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   filterDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   numFilters
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-234">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-235">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   bc
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   numFilters
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-236">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-237">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   activationsPooled
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   zeros
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   outputDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   outputDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   numFilters
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   numImages
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-238">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-239">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   convolvedFeatures
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   convDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   convDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   numFilters
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   numImages
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-240">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-241">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   images
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   imageDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   imageDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   numImges
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-242">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-243">
                  <span class="crayon-v">
                   delta_d
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   groundTruth
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-v">
                   probs
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   softmax
                  </span>
                  <span class="crayon-i">
                   layer
                  </span>
                  <span class="crayon-s">
                   's preactivation,每一个样本都对应有自己每层的误差敏感性。
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-244">
                  <span class="crayon-s">
                   Wd_grad = (1./numImages)*delta_d*activationsPooled'
                  </span>
                  <span class="crayon-o">
                   +
                  </span>
                  <span class="crayon-e ">
                   lambda*
                  </span>
                  <span class="crayon-v">
                   Wd
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-245">
                  <span class="crayon-v">
                   bd_grad
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-cn">
                   1.
                  </span>
                  <span class="crayon-o">
                   /
                  </span>
                  <span class="crayon-v">
                   numImages
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-o">
                   *
                  </span>
                  <span class="crayon-e">
                   sum
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   delta_d
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-cn">
                   2
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  注意这里是要求和
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-246">
                  <span class="crayon-v">
                   delta_s
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Wd
                  </span>
                  <span class="crayon-s">
                   '*delta_d; %the pooling/sample layer'
                  </span>
                  <span class="crayon-i">
                   s
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   preactivation
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-247">
                  <span class="crayon-v">
                   delta_s
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   reshape
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   delta_s
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   outputDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   outputDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   numFilters
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   numImages
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-248">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-249">
                  <span class="crayon-ta">
                   %
                  </span>
                  进行
                  <span class="crayon-i">
                   unsampling
                  </span>
                  操作，由于
                  <span class="crayon-i">
                   kron
                  </span>
                  函数只能对二维矩阵操作，所以还得分开弄
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-250">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-251">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-v">
                   delta_c
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   convolvedFeatures
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-o">
                   *
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-v">
                   convolvedFeatures
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-o">
                   *
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-cn">
                   1.
                  </span>
                  <span class="crayon-o">
                   /
                  </span>
                  <span class="crayon-v">
                   poolDim
                  </span>
                  <span class="crayon-o">
                   ^
                  </span>
                  <span class="crayon-cn">
                   2
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-o">
                   *
                  </span>
                  <span class="crayon-e">
                   kron
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   delta_s
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   ones
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   poolDim
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-252">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-253">
                  <span class="crayon-v">
                   delta_c
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   zeros
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   convDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   convDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   numFilters
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   numImages
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-254">
                  <span class="crayon-st">
                   for
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   i
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-e">
                   numImages
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-255">
                  <span class="crayon-e">
                  </span>
                  <span class="crayon-st">
                   for
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   j
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-e">
                   numFilters
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-256">
                  <span class="crayon-e">
                  </span>
                  <span class="crayon-e">
                   delta_c
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   j
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   i
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-cn">
                   1.
                  </span>
                  <span class="crayon-o">
                   /
                  </span>
                  <span class="crayon-v">
                   poolDim
                  </span>
                  <span class="crayon-o">
                   ^
                  </span>
                  <span class="crayon-cn">
                   2
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-o">
                   *
                  </span>
                  <span class="crayon-e">
                   kron
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-e">
                   squeeze
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-e">
                   delta_s
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   j
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   i
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   ones
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   poolDim
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-257">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   end
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-258">
                  <span class="crayon-st">
                   end
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-259">
                  <span class="crayon-v">
                   delta_c
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   convolvedFeatures
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-o">
                   *
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-v">
                   convolvedFeatures
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-o">
                   *
                  </span>
                  <span class="crayon-v">
                   delta_c
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-260">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-261">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   Wc_grad
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   convn
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   images
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-e">
                   rot90
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   delta_c
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-cn">
                   2
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-s">
                   'valid'
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-o">
                   +
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   lambda
                  </span>
                  <span class="crayon-o">
                   *
                  </span>
                  <span class="crayon-v">
                   Wc
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-262">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-263">
                  <span class="crayon-st">
                   for
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   i
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-e">
                   numFilters
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-264">
                  <span class="crayon-e">
                  </span>
                  <span class="crayon-v">
                   Wc_i
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   zeros
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   filterDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   filterDim
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-265">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   for
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   j
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-e">
                   numImages
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-266">
                  <span class="crayon-e">
                  </span>
                  <span class="crayon-v">
                   Wc_i
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   Wc_i
                  </span>
                  <span class="crayon-o">
                   +
                  </span>
                  <span class="crayon-e">
                   conv2
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-e">
                   squeeze
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-e">
                   images
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   j
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-e">
                   rot90
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-e">
                   squeeze
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-e">
                   delta_c
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   i
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   j
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-cn">
                   2
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-s">
                   'valid'
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-267">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   end
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-268">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   Wc_i
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   convn
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   images
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-e">
                   rot180
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-e">
                   squeeze
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-e">
                   delta_c
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   i
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-s">
                   'valid'
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-269">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   add
                  </span>
                  <span class="crayon-e">
                   penalize
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-270">
                  <span class="crayon-e">
                  </span>
                  <span class="crayon-e">
                   Wc_grad
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   i
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-cn">
                   1.
                  </span>
                  <span class="crayon-o">
                   /
                  </span>
                  <span class="crayon-v">
                   numImages
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-o">
                   *
                  </span>
                  <span class="crayon-v">
                   Wc_i
                  </span>
                  <span class="crayon-o">
                   +
                  </span>
                  <span class="crayon-e ">
                   lambda*
                  </span>
                  <span class="crayon-e">
                   Wc
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   i
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-271">
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-272">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   bc_i
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   delta_c
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   i
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-273">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   bc_i
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   bc_i
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-274">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   bc_grad
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   i
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   sum
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   bc_i
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-o">
                   /
                  </span>
                  <span class="crayon-v">
                   numImages
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-275">
                  <span class="crayon-st">
                   end
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-276">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-277">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Unroll
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   gradient
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   into
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   grad
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   vector
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   for
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   minFunc
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-278">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-279">
                  <span class="crayon-v">
                   grad
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-sy">
                   [
                  </span>
                  <span class="crayon-e">
                   Wc_grad
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   Wd_grad
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   bc_grad
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   bd_grad
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ]
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-280">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-281">
                  <span class="crayon-st">
                   end
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-282">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-283">
                  <span class="crayon-t">
                   function
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   X
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   rot180
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   X
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007f1755638580-284">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   X
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   flipdim
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-e">
                   flipdim
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   X
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   2
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007f1755638580-285">
                  <span class="crayon-st">
                   end
                  </span>
                 </div>
                </div>
               </td>
              </tr>
             </tbody>
            </table>
           </div>
          </div>
          <!-- [Format Time: 0.3942 seconds] -->
          <p>
          </p>
          <div class="cnblogs_code_toolbar">
           <span class="cnblogs_code_copy">
            <p title="复制代码">
             <img src="http://dataunion.org/wp-content/uploads/2014/12/copycode3.gif"/>
            </p>
           </span>
          </div>
         </div>
         <p>
         </p>
         <p>
          <em>
           <strong>
            minFuncSGD.m:
           </strong>
          </em>
          <em>
           <strong>
           </strong>
          </em>
         </p>
         <div class="cnblogs_code">
          <div class="cnblogs_code_toolbar">
           <span class="cnblogs_code_copy">
            <p title="复制代码">
             <img src="http://dataunion.org/wp-content/uploads/2014/12/copycode3.gif"/>
            </p>
           </span>
          </div>
          <p>
          </p>
          <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
          <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-576852be007ff289338203" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
           <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
            <span class="crayon-title">
            </span>
            <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
             <span class="crayon-mixed-highlight" title="含多种语言">
             </span>
             <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
              <div class="crayon-button-icon">
              </div>
             </div>
             <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
              <div class="crayon-button-icon">
              </div>
             </div>
             <div class="crayon-button crayon-wrap-button" title="切换自动换行">
              <div class="crayon-button-icon">
              </div>
             </div>
             <div class="crayon-button crayon-expand-button" title="点击展开代码">
              <div class="crayon-button-icon">
              </div>
             </div>
             <div class="crayon-button crayon-copy-button" title="复制代码">
              <div class="crayon-button-icon">
              </div>
             </div>
             <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
              <div class="crayon-button-icon">
              </div>
             </div>
            </div>
           </div>
           <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
           </div>
           <div class="crayon-plain-wrap">
            <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
             function [opttheta] = minFuncSGD(funObj,theta,data,labels,...
                        options)
% Runs stochastic gradient descent with momentum to optimize the
% parameters for the given objective.
%
% Parameters:
%  funObj     -  function handle which accepts as input theta,
%                data, labels and returns cost and gradient w.r.t
%                to theta.
%  theta      -  unrolled parameter vector
%  data       -  stores data in m x n x numExamples tensor
%  labels     -  corresponding labels in numExamples x 1 vector
%  options    -  struct to store specific options for optimization
%
% Returns:
%  opttheta   -  optimized parameter vector
%
% Options (* required)
%  epochs*     - number of epochs through data
%  alpha*      - initial learning rate
%  minibatch*  - size of minibatch
%  momentum    - momentum constant, defualts to 0.9


%%======================================================================
%% Setup
assert(all(isfield(options,{'epochs','alpha','minibatch'})),...
        'Some options not defined');
if ~isfield(options,'momentum')
    options.momentum = 0.9;
end;
epochs = options.epochs;
alpha = options.alpha;
minibatch = options.minibatch;
m = length(labels); % training set size
% Setup for momentum
mom = 0.5;
momIncrease = 20;
velocity = zeros(size(theta));

%%======================================================================
%% SGD loop
it = 0;
for e = 1:epochs
    
    % randomly permute indices of data for quick minibatch sampling
    rp = randperm(m);
    
    for s=1:minibatch:(m-minibatch+1)
        it = it + 1;

        % increase momentum after momIncrease iterations
        if it == momIncrease
            mom = options.momentum;
        end;

        % get next randomly selected minibatch
        mb_data = data(:,:,rp(s:s+minibatch-1)); % 取出当前的mini-batch的训练样本
        mb_labels = labels(rp(s:s+minibatch-1));

        % evaluate the objective function on the next minibatch
        [cost grad] = funObj(theta,mb_data,mb_labels);
        
        % Instructions: Add in the weighted velocity vector to the
        % gradient evaluated above scaled by the learning rate.
        % Then update the current weights theta according to the
        % sgd update rule
        
        %%% YOUR CODE HERE %%%
        velocity = mom*velocity+alpha*grad; % 见ufldl教程Optimization: Stochastic Gradient Descent
        theta = theta-velocity;
        
        fprintf('Epoch %d: Cost on iteration %d is %f\n',e,it,cost);
    end;

    % aneal learning rate by factor of two after each epoch
    alpha = alpha/2.0;

end;

opttheta = theta;

end
            </textarea>
           </div>
           <div class="crayon-main" style="">
            <table class="crayon-table">
             <tbody>
              <tr class="crayon-row">
               <td class="crayon-nums " data-settings="show">
                <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                 <div class="crayon-num" data-line="crayon-576852be007ff289338203-1">
                  1
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007ff289338203-2">
                  2
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007ff289338203-3">
                  3
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007ff289338203-4">
                  4
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007ff289338203-5">
                  5
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007ff289338203-6">
                  6
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007ff289338203-7">
                  7
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007ff289338203-8">
                  8
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007ff289338203-9">
                  9
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007ff289338203-10">
                  10
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007ff289338203-11">
                  11
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007ff289338203-12">
                  12
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007ff289338203-13">
                  13
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007ff289338203-14">
                  14
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007ff289338203-15">
                  15
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007ff289338203-16">
                  16
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007ff289338203-17">
                  17
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007ff289338203-18">
                  18
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007ff289338203-19">
                  19
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007ff289338203-20">
                  20
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007ff289338203-21">
                  21
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007ff289338203-22">
                  22
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007ff289338203-23">
                  23
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007ff289338203-24">
                  24
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007ff289338203-25">
                  25
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007ff289338203-26">
                  26
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007ff289338203-27">
                  27
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007ff289338203-28">
                  28
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007ff289338203-29">
                  29
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007ff289338203-30">
                  30
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007ff289338203-31">
                  31
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007ff289338203-32">
                  32
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007ff289338203-33">
                  33
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007ff289338203-34">
                  34
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007ff289338203-35">
                  35
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007ff289338203-36">
                  36
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007ff289338203-37">
                  37
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007ff289338203-38">
                  38
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007ff289338203-39">
                  39
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007ff289338203-40">
                  40
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007ff289338203-41">
                  41
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007ff289338203-42">
                  42
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007ff289338203-43">
                  43
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007ff289338203-44">
                  44
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007ff289338203-45">
                  45
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007ff289338203-46">
                  46
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007ff289338203-47">
                  47
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007ff289338203-48">
                  48
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007ff289338203-49">
                  49
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007ff289338203-50">
                  50
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007ff289338203-51">
                  51
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007ff289338203-52">
                  52
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007ff289338203-53">
                  53
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007ff289338203-54">
                  54
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007ff289338203-55">
                  55
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007ff289338203-56">
                  56
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007ff289338203-57">
                  57
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007ff289338203-58">
                  58
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007ff289338203-59">
                  59
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007ff289338203-60">
                  60
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007ff289338203-61">
                  61
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007ff289338203-62">
                  62
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007ff289338203-63">
                  63
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007ff289338203-64">
                  64
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007ff289338203-65">
                  65
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007ff289338203-66">
                  66
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007ff289338203-67">
                  67
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007ff289338203-68">
                  68
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007ff289338203-69">
                  69
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007ff289338203-70">
                  70
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007ff289338203-71">
                  71
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007ff289338203-72">
                  72
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007ff289338203-73">
                  73
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007ff289338203-74">
                  74
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007ff289338203-75">
                  75
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007ff289338203-76">
                  76
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007ff289338203-77">
                  77
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007ff289338203-78">
                  78
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007ff289338203-79">
                  79
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007ff289338203-80">
                  80
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007ff289338203-81">
                  81
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007ff289338203-82">
                  82
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007ff289338203-83">
                  83
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007ff289338203-84">
                  84
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007ff289338203-85">
                  85
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007ff289338203-86">
                  86
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007ff289338203-87">
                  87
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007ff289338203-88">
                  88
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007ff289338203-89">
                  89
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007ff289338203-90">
                  90
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007ff289338203-91">
                  91
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007ff289338203-92">
                  92
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007ff289338203-93">
                  93
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007ff289338203-94">
                  94
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007ff289338203-95">
                  95
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007ff289338203-96">
                  96
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007ff289338203-97">
                  97
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007ff289338203-98">
                  98
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007ff289338203-99">
                  99
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007ff289338203-100">
                  100
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007ff289338203-101">
                  101
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007ff289338203-102">
                  102
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007ff289338203-103">
                  103
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007ff289338203-104">
                  104
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007ff289338203-105">
                  105
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007ff289338203-106">
                  106
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be007ff289338203-107">
                  107
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be007ff289338203-108">
                  108
                 </div>
                </div>
               </td>
               <td class="crayon-code">
                <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                 <div class="crayon-line" id="crayon-576852be007ff289338203-1">
                  <span class="crayon-t">
                   function
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-sy">
                   [
                  </span>
                  <span class="crayon-v">
                   opttheta
                  </span>
                  <span class="crayon-sy">
                   ]
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   minFuncSGD
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   funObj
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   theta
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   data
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   labels
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007ff289338203-2">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   options
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007ff289338203-3">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Runs
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   stochastic
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   gradient
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   descent
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   with
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   momentum
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   to
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   optimize
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007ff289338203-4">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007ff289338203-5">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   parameters
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   for
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   given
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   objective
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007ff289338203-6">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007ff289338203-7">
                  <span class="crayon-ta">
                   %
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007ff289338203-8">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007ff289338203-9">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   Parameters
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007ff289338203-10">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007ff289338203-11">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   funObj
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   function
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   handle
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   which
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   accepts
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   as
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   input
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   theta
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007ff289338203-12">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007ff289338203-13">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-t">
                   data
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   labels
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   and
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   returns
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   cost
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   and
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   gradient
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   w
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-v">
                   r
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-i">
                   t
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007ff289338203-14">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007ff289338203-15">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   to
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   theta
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007ff289338203-16">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007ff289338203-17">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   theta
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   unrolled
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   parameter
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   vector
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007ff289338203-18">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007ff289338203-19">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-t">
                   data
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   stores
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-t">
                   data
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   in
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   m
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   x
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   n
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   x
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   numExamples
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   tensor
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007ff289338203-20">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007ff289338203-21">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   labels
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   corresponding
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   labels
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   in
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   numExamples
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   x
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   vector
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007ff289338203-22">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007ff289338203-23">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   options
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-t">
                   struct
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   to
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   store
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   specific
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   options
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   for
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   optimization
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007ff289338203-24">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007ff289338203-25">
                  <span class="crayon-ta">
                   %
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007ff289338203-26">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007ff289338203-27">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   Returns
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007ff289338203-28">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007ff289338203-29">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   opttheta
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   optimized
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   parameter
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   vector
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007ff289338203-30">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007ff289338203-31">
                  <span class="crayon-ta">
                   %
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007ff289338203-32">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007ff289338203-33">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   Options
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-o">
                   *
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   required
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007ff289338203-34">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007ff289338203-35">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   epochs
                  </span>
                  <span class="crayon-o">
                   *
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   number
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   of
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   epochs
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   through
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-t">
                   data
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007ff289338203-36">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007ff289338203-37">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   alpha
                  </span>
                  <span class="crayon-o">
                   *
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   initial
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   learning
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   rate
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007ff289338203-38">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007ff289338203-39">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   minibatch
                  </span>
                  <span class="crayon-o">
                   *
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   size
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   of
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   minibatch
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007ff289338203-40">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007ff289338203-41">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   momentum
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   momentum
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   constant
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   defualts
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   to
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   0.9
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007ff289338203-42">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007ff289338203-43">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007ff289338203-44">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007ff289338203-45">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-o">
                   %=
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007ff289338203-46">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007ff289338203-47">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Setup
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007ff289338203-48">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007ff289338203-49">
                  <span class="crayon-st">
                   assert
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-e">
                   all
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-e">
                   isfield
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   options
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-sy">
                   {
                  </span>
                  <span class="crayon-s">
                   'epochs'
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-s">
                   'alpha'
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-s">
                   'minibatch'
                  </span>
                  <span class="crayon-sy">
                   }
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007ff289338203-50">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-s">
                   'Some options not defined'
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007ff289338203-51">
                  <span class="crayon-st">
                   if
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   ~
                  </span>
                  <span class="crayon-e">
                   isfield
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   options
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-s">
                   'momentum'
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007ff289338203-52">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   options
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-v">
                   momentum
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   0.9
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007ff289338203-53">
                  <span class="crayon-st">
                   end
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007ff289338203-54">
                  <span class="crayon-v">
                   epochs
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   options
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-v">
                   epochs
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007ff289338203-55">
                  <span class="crayon-v">
                   alpha
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   options
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-v">
                   alpha
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007ff289338203-56">
                  <span class="crayon-v">
                   minibatch
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   options
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-v">
                   minibatch
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007ff289338203-57">
                  <span class="crayon-v">
                   m
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   length
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   labels
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   training
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   set
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   size
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007ff289338203-58">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Setup
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   for
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   momentum
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007ff289338203-59">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007ff289338203-60">
                  <span class="crayon-v">
                   mom
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   0.5
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007ff289338203-61">
                  <span class="crayon-v">
                   momIncrease
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   20
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007ff289338203-62">
                  <span class="crayon-v">
                   velocity
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   zeros
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-e">
                   size
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   theta
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007ff289338203-63">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007ff289338203-64">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-o">
                   %=
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                  <span class="crayon-o">
                   ===
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007ff289338203-65">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007ff289338203-66">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   SGD
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   loop
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007ff289338203-67">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007ff289338203-68">
                  <span class="crayon-v">
                   it
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   0
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007ff289338203-69">
                  <span class="crayon-st">
                   for
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   e
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-v">
                   epochs
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007ff289338203-70">
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007ff289338203-71">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   randomly
                  </span>
                  <span class="crayon-e">
                   permute
                  </span>
                  <span class="crayon-e">
                   indices
                  </span>
                  <span class="crayon-e">
                   of
                  </span>
                  <span class="crayon-e">
                   data
                  </span>
                  <span class="crayon-st">
                   for
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   quick
                  </span>
                  <span class="crayon-e">
                   minibatch
                  </span>
                  <span class="crayon-e">
                   sampling
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007ff289338203-72">
                  <span class="crayon-e">
                  </span>
                  <span class="crayon-v">
                   rp
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   randperm
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   m
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007ff289338203-73">
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007ff289338203-74">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   for
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   s
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-v">
                   minibatch
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   m
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-v">
                   minibatch
                  </span>
                  <span class="crayon-o">
                   +
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007ff289338203-75">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   it
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   it
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   +
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007ff289338203-76">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007ff289338203-77">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   increase
                  </span>
                  <span class="crayon-e">
                   momentum
                  </span>
                  <span class="crayon-e">
                   after
                  </span>
                  <span class="crayon-e">
                   momIncrease
                  </span>
                  <span class="crayon-e">
                   iterations
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007ff289338203-78">
                  <span class="crayon-e">
                  </span>
                  <span class="crayon-st">
                   if
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   it
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   ==
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   momIncrease
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007ff289338203-79">
                  <span class="crayon-e">
                  </span>
                  <span class="crayon-v">
                   mom
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   options
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-v">
                   momentum
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007ff289338203-80">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   end
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007ff289338203-81">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007ff289338203-82">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   get
                  </span>
                  <span class="crayon-e">
                   next
                  </span>
                  <span class="crayon-e">
                   randomly
                  </span>
                  <span class="crayon-e">
                   selected
                  </span>
                  <span class="crayon-e">
                   minibatch
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007ff289338203-83">
                  <span class="crayon-e">
                  </span>
                  <span class="crayon-v">
                   mb_data
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   data
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-e">
                   rp
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   s
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-v">
                   s
                  </span>
                  <span class="crayon-o">
                   +
                  </span>
                  <span class="crayon-v">
                   minibatch
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  取出当前的
                  <span class="crayon-v">
                   mini
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-i">
                   batch
                  </span>
                  的训练样本
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007ff289338203-84">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   mb_labels
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   labels
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-e">
                   rp
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   s
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-v">
                   s
                  </span>
                  <span class="crayon-o">
                   +
                  </span>
                  <span class="crayon-v">
                   minibatch
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007ff289338203-85">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007ff289338203-86">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   evaluate
                  </span>
                  <span class="crayon-e">
                   the
                  </span>
                  <span class="crayon-e">
                   objective
                  </span>
                  <span class="crayon-t">
                   function
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   on
                  </span>
                  <span class="crayon-e">
                   the
                  </span>
                  <span class="crayon-e">
                   next
                  </span>
                  <span class="crayon-i">
                   minibatch
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007ff289338203-87">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-sy">
                   [
                  </span>
                  <span class="crayon-e">
                   cost
                  </span>
                  <span class="crayon-v">
                   grad
                  </span>
                  <span class="crayon-sy">
                   ]
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   funObj
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   theta
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   mb_data
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   mb_labels
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007ff289338203-88">
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007ff289338203-89">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   Instructions
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   Add
                  </span>
                  <span class="crayon-st">
                   in
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   the
                  </span>
                  <span class="crayon-e">
                   weighted
                  </span>
                  <span class="crayon-e">
                   velocity
                  </span>
                  <span class="crayon-e">
                   vector
                  </span>
                  <span class="crayon-st">
                   to
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   the
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007ff289338203-90">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   gradient
                  </span>
                  <span class="crayon-e">
                   evaluated
                  </span>
                  <span class="crayon-e">
                   above
                  </span>
                  <span class="crayon-e">
                   scaled
                  </span>
                  <span class="crayon-e">
                   by
                  </span>
                  <span class="crayon-e">
                   the
                  </span>
                  <span class="crayon-e">
                   learning
                  </span>
                  <span class="crayon-v">
                   rate
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007ff289338203-91">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   Then
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   update
                  </span>
                  <span class="crayon-e">
                   the
                  </span>
                  <span class="crayon-e">
                   current
                  </span>
                  <span class="crayon-e">
                   weights
                  </span>
                  <span class="crayon-e">
                   theta
                  </span>
                  <span class="crayon-e">
                   according
                  </span>
                  <span class="crayon-st">
                   to
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   the
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007ff289338203-92">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   sgd
                  </span>
                  <span class="crayon-e">
                   update
                  </span>
                  <span class="crayon-v">
                   rule
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007ff289338203-93">
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007ff289338203-94">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   YOUR
                  </span>
                  <span class="crayon-e">
                   CODE
                  </span>
                  <span class="crayon-v">
                   HERE
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007ff289338203-95">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   velocity
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e ">
                   mom*
                  </span>
                  <span class="crayon-v">
                   velocity
                  </span>
                  <span class="crayon-o">
                   +
                  </span>
                  <span class="crayon-e ">
                   alpha*
                  </span>
                  <span class="crayon-v">
                   grad
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  见
                  <span class="crayon-i">
                   ufldl
                  </span>
                  教程
                  <span class="crayon-v">
                   Optimization
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   Stochastic
                  </span>
                  <span class="crayon-e">
                   Gradient
                  </span>
                  <span class="crayon-e">
                   Descent
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007ff289338203-96">
                  <span class="crayon-e">
                  </span>
                  <span class="crayon-v">
                   theta
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   theta
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-v">
                   velocity
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007ff289338203-97">
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007ff289338203-98">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   fprintf
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-s">
                   'Epoch %d: Cost on iteration %d is %f\n'
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   e
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   it
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   cost
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007ff289338203-99">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   end
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007ff289338203-100">
                 </div>
                 <div class="crayon-line" id="crayon-576852be007ff289338203-101">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   aneal
                  </span>
                  <span class="crayon-e">
                   learning
                  </span>
                  <span class="crayon-e">
                   rate
                  </span>
                  <span class="crayon-e">
                   by
                  </span>
                  <span class="crayon-e">
                   factor
                  </span>
                  <span class="crayon-e">
                   of
                  </span>
                  <span class="crayon-e">
                   two
                  </span>
                  <span class="crayon-e">
                   after
                  </span>
                  <span class="crayon-st">
                   each
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   epoch
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007ff289338203-102">
                  <span class="crayon-e">
                  </span>
                  <span class="crayon-v">
                   alpha
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   alpha
                  </span>
                  <span class="crayon-o">
                   /
                  </span>
                  <span class="crayon-cn">
                   2.0
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007ff289338203-103">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007ff289338203-104">
                  <span class="crayon-st">
                   end
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007ff289338203-105">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007ff289338203-106">
                  <span class="crayon-v">
                   opttheta
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   theta
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be007ff289338203-107">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be007ff289338203-108">
                  <span class="crayon-st">
                   end
                  </span>
                 </div>
                </div>
               </td>
              </tr>
             </tbody>
            </table>
           </div>
          </div>
          <!-- [Format Time: 0.0900 seconds] -->
          <p>
          </p>
          <div class="cnblogs_code_toolbar">
           <span class="cnblogs_code_copy">
            <p title="复制代码">
             <img src="http://dataunion.org/wp-content/uploads/2014/12/copycode3.gif"/>
            </p>
           </span>
          </div>
         </div>
         <p>
         </p>
         <p>
          <em>
           <strong>
            computeNumericalGradient.m:
           </strong>
          </em>
          <em>
           <strong>
           </strong>
          </em>
         </p>
         <div class="cnblogs_code">
          <div class="cnblogs_code_toolbar">
           <span class="cnblogs_code_copy">
            <p title="复制代码">
             <img src="http://dataunion.org/wp-content/uploads/2014/12/copycode3.gif"/>
            </p>
           </span>
          </div>
          <p>
          </p>
          <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
          <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-576852be00809555296830" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
           <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
            <span class="crayon-title">
            </span>
            <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
             <span class="crayon-mixed-highlight" title="含多种语言">
             </span>
             <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
              <div class="crayon-button-icon">
              </div>
             </div>
             <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
              <div class="crayon-button-icon">
              </div>
             </div>
             <div class="crayon-button crayon-wrap-button" title="切换自动换行">
              <div class="crayon-button-icon">
              </div>
             </div>
             <div class="crayon-button crayon-expand-button" title="点击展开代码">
              <div class="crayon-button-icon">
              </div>
             </div>
             <div class="crayon-button crayon-copy-button" title="复制代码">
              <div class="crayon-button-icon">
              </div>
             </div>
             <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
              <div class="crayon-button-icon">
              </div>
             </div>
            </div>
           </div>
           <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
           </div>
           <div class="crayon-plain-wrap">
            <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
             function numgrad = computeNumericalGradient(J, theta)
% numgrad = computeNumericalGradient(J, theta)
% theta: a vector of parameters
% J: a function that outputs a real-number. Calling y = J(theta) will return the
% function value at theta. 
  
% Initialize numgrad with zeros
numgrad = zeros(size(theta));

%% ---------- YOUR CODE HERE --------------------------------------
% Instructions: 
% Implement numerical gradient checking, and return the result in numgrad.  
% (See Section 2.3 of the lecture notes.)
% You should write code so that numgrad(i) is (the numerical approximation to) the 
% partial derivative of J with respect to the i-th input argument, evaluated at theta.  
% I.e., numgrad(i) should be the (approximately) the partial derivative of J with 
% respect to theta(i).
%                
% Hint: You will probably want to compute the elements of numgrad one at a time. 

epsilon = 1e-4;

for i =1:length(numgrad)
    oldT = theta(i);
    theta(i)=oldT+epsilon;
    pos = J(theta);
    theta(i)=oldT-epsilon;
    neg = J(theta);
    numgrad(i) = (pos-neg)/(2*epsilon);
    theta(i)=oldT;
    if mod(i,100)==0
       fprintf('Done with %d\n',i);
    end;
end;


%% ---------------------------------------------------------------
end
            </textarea>
           </div>
           <div class="crayon-main" style="">
            <table class="crayon-table">
             <tbody>
              <tr class="crayon-row">
               <td class="crayon-nums " data-settings="show">
                <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                 <div class="crayon-num" data-line="crayon-576852be00809555296830-1">
                  1
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00809555296830-2">
                  2
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00809555296830-3">
                  3
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00809555296830-4">
                  4
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00809555296830-5">
                  5
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00809555296830-6">
                  6
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00809555296830-7">
                  7
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00809555296830-8">
                  8
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00809555296830-9">
                  9
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00809555296830-10">
                  10
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00809555296830-11">
                  11
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00809555296830-12">
                  12
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00809555296830-13">
                  13
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00809555296830-14">
                  14
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00809555296830-15">
                  15
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00809555296830-16">
                  16
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00809555296830-17">
                  17
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00809555296830-18">
                  18
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00809555296830-19">
                  19
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00809555296830-20">
                  20
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00809555296830-21">
                  21
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00809555296830-22">
                  22
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00809555296830-23">
                  23
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00809555296830-24">
                  24
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00809555296830-25">
                  25
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00809555296830-26">
                  26
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00809555296830-27">
                  27
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00809555296830-28">
                  28
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00809555296830-29">
                  29
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00809555296830-30">
                  30
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00809555296830-31">
                  31
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00809555296830-32">
                  32
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00809555296830-33">
                  33
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00809555296830-34">
                  34
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00809555296830-35">
                  35
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00809555296830-36">
                  36
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00809555296830-37">
                  37
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00809555296830-38">
                  38
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00809555296830-39">
                  39
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00809555296830-40">
                  40
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00809555296830-41">
                  41
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00809555296830-42">
                  42
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00809555296830-43">
                  43
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00809555296830-44">
                  44
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00809555296830-45">
                  45
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00809555296830-46">
                  46
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00809555296830-47">
                  47
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00809555296830-48">
                  48
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00809555296830-49">
                  49
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00809555296830-50">
                  50
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00809555296830-51">
                  51
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00809555296830-52">
                  52
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00809555296830-53">
                  53
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00809555296830-54">
                  54
                 </div>
                </div>
               </td>
               <td class="crayon-code">
                <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                 <div class="crayon-line" id="crayon-576852be00809555296830-1">
                  <span class="crayon-t">
                   function
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   numgrad
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   computeNumericalGradient
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   J
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   theta
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00809555296830-2">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   numgrad
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   computeNumericalGradient
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   J
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   theta
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be00809555296830-3">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00809555296830-4">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   theta
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   a
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   vector
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   of
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   parameters
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be00809555296830-5">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00809555296830-6">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   J
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   a
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   function
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   that
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   outputs
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   a
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   real
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-v">
                   number
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Calling
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   y
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   J
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   theta
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   will
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   return
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be00809555296830-7">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00809555296830-8">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   function
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   value
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   at
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   theta
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be00809555296830-9">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00809555296830-10">
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be00809555296830-11">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Initialize
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   numgrad
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   with
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   zeros
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00809555296830-12">
                 </div>
                 <div class="crayon-line" id="crayon-576852be00809555296830-13">
                  <span class="crayon-v">
                   numgrad
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   zeros
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-e">
                   size
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   theta
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00809555296830-14">
                 </div>
                 <div class="crayon-line" id="crayon-576852be00809555296830-15">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   YOUR
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   CODE
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   HERE
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00809555296830-16">
                 </div>
                 <div class="crayon-line" id="crayon-576852be00809555296830-17">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   Instructions
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00809555296830-18">
                 </div>
                 <div class="crayon-line" id="crayon-576852be00809555296830-19">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Implement
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   numerical
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   gradient
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   checking
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   and
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   return
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   result
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   in
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   numgrad
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00809555296830-20">
                 </div>
                 <div class="crayon-line" id="crayon-576852be00809555296830-21">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-i">
                   See
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Section
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   2.3
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   of
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   lecture
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   notes
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00809555296830-22">
                 </div>
                 <div class="crayon-line" id="crayon-576852be00809555296830-23">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   You
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   should
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   write
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   code
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   so
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   that
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   numgrad
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   i
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   is
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   numerical
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   approximation
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   to
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00809555296830-24">
                 </div>
                 <div class="crayon-line" id="crayon-576852be00809555296830-25">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   partial
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   derivative
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   of
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   J
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   with
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   respect
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   to
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   i
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-i">
                   th
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   input
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   argument
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   evaluated
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   at
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   theta
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00809555296830-26">
                 </div>
                 <div class="crayon-line" id="crayon-576852be00809555296830-27">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   I
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-v">
                   e
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   numgrad
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   i
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   should
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   be
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   approximately
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   partial
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   derivative
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   of
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   J
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   with
                  </span>
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00809555296830-28">
                 </div>
                 <div class="crayon-line" id="crayon-576852be00809555296830-29">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   respect
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   to
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   theta
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   i
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00809555296830-30">
                 </div>
                 <div class="crayon-line" id="crayon-576852be00809555296830-31">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00809555296830-32">
                 </div>
                 <div class="crayon-line" id="crayon-576852be00809555296830-33">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   Hint
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   You
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   will
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   probably
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   want
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   to
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   compute
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   elements
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   of
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   numgrad
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   one
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   at
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   a
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-t">
                   time
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00809555296830-34">
                 </div>
                 <div class="crayon-line" id="crayon-576852be00809555296830-35">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00809555296830-36">
                  <span class="crayon-v">
                   epsilon
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   1e
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-cn">
                   4
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be00809555296830-37">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00809555296830-38">
                  <span class="crayon-st">
                   for
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   i
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-e">
                   length
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   numgrad
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be00809555296830-39">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   oldT
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   theta
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   i
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00809555296830-40">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   theta
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   i
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-v">
                   oldT
                  </span>
                  <span class="crayon-o">
                   +
                  </span>
                  <span class="crayon-v">
                   epsilon
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be00809555296830-41">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   pos
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   J
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   theta
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00809555296830-42">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   theta
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   i
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-v">
                   oldT
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-v">
                   epsilon
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be00809555296830-43">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   neg
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   J
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   theta
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00809555296830-44">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   numgrad
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   i
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   pos
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-v">
                   neg
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-o">
                   /
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-cn">
                   2
                  </span>
                  <span class="crayon-o">
                   *
                  </span>
                  <span class="crayon-v">
                   epsilon
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be00809555296830-45">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   theta
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   i
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-v">
                   oldT
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00809555296830-46">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   if
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   mod
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   i
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-cn">
                   100
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-o">
                   ==
                  </span>
                  <span class="crayon-cn">
                   0
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be00809555296830-47">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   fprintf
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-s">
                   'Done with %d\n'
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   i
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00809555296830-48">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   end
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be00809555296830-49">
                  <span class="crayon-st">
                   end
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00809555296830-50">
                 </div>
                 <div class="crayon-line" id="crayon-576852be00809555296830-51">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00809555296830-52">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-o">
                   --
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be00809555296830-53">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00809555296830-54">
                  <span class="crayon-st">
                   end
                  </span>
                 </div>
                </div>
               </td>
              </tr>
             </tbody>
            </table>
           </div>
          </div>
          <!-- [Format Time: 0.0535 seconds] -->
          <p>
          </p>
          <div class="cnblogs_code_toolbar">
           <span class="cnblogs_code_copy">
            <p title="复制代码">
             <img src="http://dataunion.org/wp-content/uploads/2014/12/copycode3.gif"/>
            </p>
           </span>
          </div>
         </div>
         <p>
         </p>
         <p>
          <em>
           <strong>
            cnnInitParams.m:
           </strong>
          </em>
          <em>
           <strong>
           </strong>
          </em>
         </p>
         <div class="cnblogs_code">
          <div class="cnblogs_code_toolbar">
           <span class="cnblogs_code_copy">
            <p title="复制代码">
             <img src="http://dataunion.org/wp-content/uploads/2014/12/copycode3.gif"/>
            </p>
           </span>
          </div>
          <p>
          </p>
          <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
          <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-576852be00811102751016" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
           <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
            <span class="crayon-title">
            </span>
            <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
             <span class="crayon-mixed-highlight" title="含多种语言">
             </span>
             <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
              <div class="crayon-button-icon">
              </div>
             </div>
             <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
              <div class="crayon-button-icon">
              </div>
             </div>
             <div class="crayon-button crayon-wrap-button" title="切换自动换行">
              <div class="crayon-button-icon">
              </div>
             </div>
             <div class="crayon-button crayon-expand-button" title="点击展开代码">
              <div class="crayon-button-icon">
              </div>
             </div>
             <div class="crayon-button crayon-copy-button" title="复制代码">
              <div class="crayon-button-icon">
              </div>
             </div>
             <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
              <div class="crayon-button-icon">
              </div>
             </div>
            </div>
           </div>
           <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
           </div>
           <div class="crayon-plain-wrap">
            <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
             function theta = cnnInitParams(imageDim,filterDim,numFilters,...
                                poolDim,numClasses)
% Initialize parameters for a single layer convolutional neural
% network followed by a softmax layer.
%                            
% Parameters:
%  imageDim   -  height/width of image
%  filterDim  -  dimension of convolutional filter                            
%  numFilters -  number of convolutional filters
%  poolDim    -  dimension of pooling area
%  numClasses -  number of classes to predict
%
%
% Returns:
%  theta      -  unrolled parameter vector with initialized weights

%% Initialize parameters randomly based on layer sizes.
assert(filterDim &amp;lt; imageDim,'filterDim must be less that imageDim');

Wc = 1e-1*randn(filterDim,filterDim,numFilters);

outDim = imageDim - filterDim + 1; % dimension of convolved image

% assume outDim is multiple of poolDim
assert(mod(outDim,poolDim)==0,...
       'poolDim must divide imageDim - filterDim + 1');

outDim = outDim/poolDim;
hiddenSize = outDim^2*numFilters;

% we'll choose weights uniformly from the interval [-r, r]
r  = sqrt(6) / sqrt(numClasses+hiddenSize+1);
Wd = rand(numClasses, hiddenSize) * 2 * r - r;

bc = zeros(numFilters, 1); %初始化为0
bd = zeros(numClasses, 1);

% Convert weights and bias gradients to the vector form.
% This step will "unroll" (flatten and concatenate together) all 
% your parameters into a vector, which can then be used with minFunc. 
theta = [Wc(:) ; Wd(:) ; bc(:) ; bd(:)];

end
            </textarea>
           </div>
           <div class="crayon-main" style="">
            <table class="crayon-table">
             <tbody>
              <tr class="crayon-row">
               <td class="crayon-nums " data-settings="show">
                <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                 <div class="crayon-num" data-line="crayon-576852be00811102751016-1">
                  1
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00811102751016-2">
                  2
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00811102751016-3">
                  3
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00811102751016-4">
                  4
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00811102751016-5">
                  5
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00811102751016-6">
                  6
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00811102751016-7">
                  7
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00811102751016-8">
                  8
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00811102751016-9">
                  9
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00811102751016-10">
                  10
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00811102751016-11">
                  11
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00811102751016-12">
                  12
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00811102751016-13">
                  13
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00811102751016-14">
                  14
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00811102751016-15">
                  15
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00811102751016-16">
                  16
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00811102751016-17">
                  17
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00811102751016-18">
                  18
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00811102751016-19">
                  19
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00811102751016-20">
                  20
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00811102751016-21">
                  21
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00811102751016-22">
                  22
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00811102751016-23">
                  23
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00811102751016-24">
                  24
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00811102751016-25">
                  25
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00811102751016-26">
                  26
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00811102751016-27">
                  27
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00811102751016-28">
                  28
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00811102751016-29">
                  29
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00811102751016-30">
                  30
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00811102751016-31">
                  31
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00811102751016-32">
                  32
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00811102751016-33">
                  33
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00811102751016-34">
                  34
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00811102751016-35">
                  35
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00811102751016-36">
                  36
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00811102751016-37">
                  37
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00811102751016-38">
                  38
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00811102751016-39">
                  39
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00811102751016-40">
                  40
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00811102751016-41">
                  41
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00811102751016-42">
                  42
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00811102751016-43">
                  43
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00811102751016-44">
                  44
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00811102751016-45">
                  45
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00811102751016-46">
                  46
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00811102751016-47">
                  47
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00811102751016-48">
                  48
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00811102751016-49">
                  49
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00811102751016-50">
                  50
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00811102751016-51">
                  51
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00811102751016-52">
                  52
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00811102751016-53">
                  53
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00811102751016-54">
                  54
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00811102751016-55">
                  55
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00811102751016-56">
                  56
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00811102751016-57">
                  57
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00811102751016-58">
                  58
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00811102751016-59">
                  59
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00811102751016-60">
                  60
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00811102751016-61">
                  61
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00811102751016-62">
                  62
                 </div>
                </div>
               </td>
               <td class="crayon-code">
                <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                 <div class="crayon-line" id="crayon-576852be00811102751016-1">
                  <span class="crayon-t">
                   function
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   theta
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   cnnInitParams
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   imageDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   filterDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   numFilters
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00811102751016-2">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   poolDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   numClasses
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be00811102751016-3">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Initialize
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   parameters
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   for
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   a
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   single
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   layer
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   convolutional
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   neural
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00811102751016-4">
                 </div>
                 <div class="crayon-line" id="crayon-576852be00811102751016-5">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   network
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   followed
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   by
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   a
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   softmax
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   layer
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00811102751016-6">
                 </div>
                 <div class="crayon-line" id="crayon-576852be00811102751016-7">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00811102751016-8">
                 </div>
                 <div class="crayon-line" id="crayon-576852be00811102751016-9">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   Parameters
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00811102751016-10">
                 </div>
                 <div class="crayon-line" id="crayon-576852be00811102751016-11">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   imageDim
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   height
                  </span>
                  <span class="crayon-o">
                   /
                  </span>
                  <span class="crayon-i">
                   width
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   of
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   image
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00811102751016-12">
                 </div>
                 <div class="crayon-line" id="crayon-576852be00811102751016-13">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   filterDim
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   dimension
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   of
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   convolutional
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   filter
                  </span>
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00811102751016-14">
                 </div>
                 <div class="crayon-line" id="crayon-576852be00811102751016-15">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   numFilters
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   number
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   of
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   convolutional
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   filters
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00811102751016-16">
                 </div>
                 <div class="crayon-line" id="crayon-576852be00811102751016-17">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   poolDim
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   dimension
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   of
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   pooling
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   area
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00811102751016-18">
                 </div>
                 <div class="crayon-line" id="crayon-576852be00811102751016-19">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   numClasses
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   number
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   of
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   classes
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   to
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   predict
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00811102751016-20">
                 </div>
                 <div class="crayon-line" id="crayon-576852be00811102751016-21">
                  <span class="crayon-ta">
                   %
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00811102751016-22">
                 </div>
                 <div class="crayon-line" id="crayon-576852be00811102751016-23">
                  <span class="crayon-ta">
                   %
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00811102751016-24">
                 </div>
                 <div class="crayon-line" id="crayon-576852be00811102751016-25">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   Returns
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00811102751016-26">
                 </div>
                 <div class="crayon-line" id="crayon-576852be00811102751016-27">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   theta
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   unrolled
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   parameter
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   vector
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   with
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   initialized
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   weights
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00811102751016-28">
                 </div>
                 <div class="crayon-line" id="crayon-576852be00811102751016-29">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00811102751016-30">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Initialize
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   parameters
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   randomly
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   based
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   on
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   layer
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   sizes
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be00811102751016-31">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00811102751016-32">
                  <span class="crayon-st">
                   assert
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   filterDim
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   &amp;
                  </span>
                  <span class="crayon-v">
                   lt
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   imageDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-s">
                   'filterDim must be less that imageDim'
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be00811102751016-33">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00811102751016-34">
                  <span class="crayon-v">
                   Wc
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   1e
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-o">
                   *
                  </span>
                  <span class="crayon-e">
                   randn
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   filterDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   filterDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   numFilters
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be00811102751016-35">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00811102751016-36">
                  <span class="crayon-v">
                   outDim
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   imageDim
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   filterDim
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   +
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   dimension
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   of
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   convolved
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   image
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be00811102751016-37">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00811102751016-38">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   assume
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   outDim
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   is
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   multiple
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   of
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   poolDim
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be00811102751016-39">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00811102751016-40">
                  <span class="crayon-st">
                   assert
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-e">
                   mod
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   outDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   poolDim
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-o">
                   ==
                  </span>
                  <span class="crayon-cn">
                   0
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be00811102751016-41">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-s">
                   'poolDim must divide imageDim - filterDim + 1'
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00811102751016-42">
                 </div>
                 <div class="crayon-line" id="crayon-576852be00811102751016-43">
                  <span class="crayon-v">
                   outDim
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   outDim
                  </span>
                  <span class="crayon-o">
                   /
                  </span>
                  <span class="crayon-v">
                   poolDim
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00811102751016-44">
                  <span class="crayon-v">
                   hiddenSize
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   outDim
                  </span>
                  <span class="crayon-o">
                   ^
                  </span>
                  <span class="crayon-cn">
                   2
                  </span>
                  <span class="crayon-o">
                   *
                  </span>
                  <span class="crayon-v">
                   numFilters
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be00811102751016-45">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00811102751016-46">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   we
                  </span>
                  '
                  <span class="crayon-i">
                   ll
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   choose
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   weights
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   uniformly
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   from
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   interval
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-sy">
                   [
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-v">
                   r
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   r
                  </span>
                  <span class="crayon-sy">
                   ]
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be00811102751016-47">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00811102751016-48">
                  <span class="crayon-v">
                   r
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   sqrt
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-cn">
                   6
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   /
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   sqrt
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   numClasses
                  </span>
                  <span class="crayon-o">
                   +
                  </span>
                  <span class="crayon-v">
                   hiddenSize
                  </span>
                  <span class="crayon-o">
                   +
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be00811102751016-49">
                  <span class="crayon-v">
                   Wd
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   rand
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   numClasses
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   hiddenSize
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   *
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   2
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   *
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   r
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   r
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00811102751016-50">
                 </div>
                 <div class="crayon-line" id="crayon-576852be00811102751016-51">
                  <span class="crayon-v">
                   bc
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   zeros
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   numFilters
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  初始化为
                  <span class="crayon-cn">
                   0
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00811102751016-52">
                  <span class="crayon-v">
                   bd
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   zeros
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   numClasses
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be00811102751016-53">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00811102751016-54">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Convert
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   weights
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   and
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   bias
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   gradients
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   to
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   the
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   vector
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   form
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be00811102751016-55">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00811102751016-56">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   This
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   step
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   will
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-s">
                   "unroll"
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-i">
                   flatten
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   and
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   concatenate
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   together
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   all
                  </span>
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be00811102751016-57">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00811102751016-58">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   your
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   parameters
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   into
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   a
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   vector
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   which
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   can
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   then
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   be
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   used
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   with
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   minFunc
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be00811102751016-59">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00811102751016-60">
                  <span class="crayon-v">
                   theta
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-sy">
                   [
                  </span>
                  <span class="crayon-e">
                   Wc
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   Wd
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   bc
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   bd
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ]
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be00811102751016-61">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00811102751016-62">
                  <span class="crayon-st">
                   end
                  </span>
                 </div>
                </div>
               </td>
              </tr>
             </tbody>
            </table>
           </div>
          </div>
          <!-- [Format Time: 0.0770 seconds] -->
          <p>
          </p>
          <div class="cnblogs_code_toolbar">
           <span class="cnblogs_code_copy">
            <p title="复制代码">
             <img src="http://dataunion.org/wp-content/uploads/2014/12/copycode3.gif"/>
            </p>
           </span>
          </div>
         </div>
         <p>
         </p>
         <p>
          <em>
           <strong>
            cnnParamsToStack.m:
           </strong>
          </em>
         </p>
         <div class="cnblogs_code">
          <div class="cnblogs_code_toolbar">
           <span class="cnblogs_code_copy">
            <p title="复制代码">
             <img src="http://dataunion.org/wp-content/uploads/2014/12/copycode3.gif"/>
            </p>
           </span>
          </div>
          <p>
          </p>
          <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
          <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-576852be00819478099323" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
           <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
            <span class="crayon-title">
            </span>
            <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
             <span class="crayon-mixed-highlight" title="含多种语言">
             </span>
             <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
              <div class="crayon-button-icon">
              </div>
             </div>
             <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
              <div class="crayon-button-icon">
              </div>
             </div>
             <div class="crayon-button crayon-wrap-button" title="切换自动换行">
              <div class="crayon-button-icon">
              </div>
             </div>
             <div class="crayon-button crayon-expand-button" title="点击展开代码">
              <div class="crayon-button-icon">
              </div>
             </div>
             <div class="crayon-button crayon-copy-button" title="复制代码">
              <div class="crayon-button-icon">
              </div>
             </div>
             <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
              <div class="crayon-button-icon">
              </div>
             </div>
            </div>
           </div>
           <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
           </div>
           <div class="crayon-plain-wrap">
            <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
             function [Wc, Wd, bc, bd] = cnnParamsToStack(theta,imageDim,filterDim,...
                                 numFilters,poolDim,numClasses)
% Converts unrolled parameters for a single layer convolutional neural
% network followed by a softmax layer into structured weight
% tensors/matrices and corresponding biases
%                            
% Parameters:
%  theta      -  unrolled parameter vectore
%  imageDim   -  height/width of image
%  filterDim  -  dimension of convolutional filter                            
%  numFilters -  number of convolutional filters
%  poolDim    -  dimension of pooling area
%  numClasses -  number of classes to predict
%
%
% Returns:
%  Wc      -  filterDim x filterDim x numFilters parameter matrix
%  Wd      -  numClasses x hiddenSize parameter matrix, hiddenSize is
%             calculated as numFilters*((imageDim-filterDim+1)/poolDim)^2 
%  bc      -  bias for convolution layer of size numFilters x 1
%  bd      -  bias for dense layer of size hiddenSize x 1

outDim = (imageDim - filterDim + 1)/poolDim;
hiddenSize = outDim^2*numFilters;

%% Reshape theta
indS = 1;
indE = filterDim^2*numFilters;
Wc = reshape(theta(indS:indE),filterDim,filterDim,numFilters);
indS = indE+1;
indE = indE+hiddenSize*numClasses;
Wd = reshape(theta(indS:indE),numClasses,hiddenSize);
indS = indE+1;
indE = indE+numFilters;
bc = theta(indS:indE);
bd = theta(indE+1:end);


end
            </textarea>
           </div>
           <div class="crayon-main" style="">
            <table class="crayon-table">
             <tbody>
              <tr class="crayon-row">
               <td class="crayon-nums " data-settings="show">
                <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                 <div class="crayon-num" data-line="crayon-576852be00819478099323-1">
                  1
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00819478099323-2">
                  2
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00819478099323-3">
                  3
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00819478099323-4">
                  4
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00819478099323-5">
                  5
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00819478099323-6">
                  6
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00819478099323-7">
                  7
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00819478099323-8">
                  8
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00819478099323-9">
                  9
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00819478099323-10">
                  10
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00819478099323-11">
                  11
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00819478099323-12">
                  12
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00819478099323-13">
                  13
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00819478099323-14">
                  14
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00819478099323-15">
                  15
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00819478099323-16">
                  16
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00819478099323-17">
                  17
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00819478099323-18">
                  18
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00819478099323-19">
                  19
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00819478099323-20">
                  20
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00819478099323-21">
                  21
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00819478099323-22">
                  22
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00819478099323-23">
                  23
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00819478099323-24">
                  24
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00819478099323-25">
                  25
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00819478099323-26">
                  26
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00819478099323-27">
                  27
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00819478099323-28">
                  28
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00819478099323-29">
                  29
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00819478099323-30">
                  30
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00819478099323-31">
                  31
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00819478099323-32">
                  32
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00819478099323-33">
                  33
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00819478099323-34">
                  34
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00819478099323-35">
                  35
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00819478099323-36">
                  36
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00819478099323-37">
                  37
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00819478099323-38">
                  38
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00819478099323-39">
                  39
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00819478099323-40">
                  40
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00819478099323-41">
                  41
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00819478099323-42">
                  42
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00819478099323-43">
                  43
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00819478099323-44">
                  44
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00819478099323-45">
                  45
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00819478099323-46">
                  46
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00819478099323-47">
                  47
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00819478099323-48">
                  48
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00819478099323-49">
                  49
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00819478099323-50">
                  50
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00819478099323-51">
                  51
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00819478099323-52">
                  52
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00819478099323-53">
                  53
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00819478099323-54">
                  54
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00819478099323-55">
                  55
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00819478099323-56">
                  56
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00819478099323-57">
                  57
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00819478099323-58">
                  58
                 </div>
                 <div class="crayon-num" data-line="crayon-576852be00819478099323-59">
                  59
                 </div>
                </div>
               </td>
               <td class="crayon-code">
                <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                 <div class="crayon-line" id="crayon-576852be00819478099323-1">
                  <span class="crayon-t">
                   function
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-sy">
                   [
                  </span>
                  <span class="crayon-v">
                   Wc
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   Wd
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   bc
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   bd
                  </span>
                  <span class="crayon-sy">
                   ]
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   cnnParamsToStack
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   theta
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   imageDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   filterDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                  <span class="crayon-sy">
                   .
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00819478099323-2">
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   numFilters
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   poolDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   numClasses
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be00819478099323-3">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Converts
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   unrolled
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   parameters
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   for
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   a
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   single
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   layer
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   convolutional
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   neural
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00819478099323-4">
                 </div>
                 <div class="crayon-line" id="crayon-576852be00819478099323-5">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   network
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   followed
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   by
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   a
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   softmax
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   layer
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   into
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   structured
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   weight
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00819478099323-6">
                 </div>
                 <div class="crayon-line" id="crayon-576852be00819478099323-7">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   tensors
                  </span>
                  <span class="crayon-o">
                   /
                  </span>
                  <span class="crayon-i">
                   matrices
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   and
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   corresponding
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   biases
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00819478099323-8">
                 </div>
                 <div class="crayon-line" id="crayon-576852be00819478099323-9">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00819478099323-10">
                 </div>
                 <div class="crayon-line" id="crayon-576852be00819478099323-11">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   Parameters
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00819478099323-12">
                 </div>
                 <div class="crayon-line" id="crayon-576852be00819478099323-13">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   theta
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   unrolled
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   parameter
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   vectore
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00819478099323-14">
                 </div>
                 <div class="crayon-line" id="crayon-576852be00819478099323-15">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   imageDim
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   height
                  </span>
                  <span class="crayon-o">
                   /
                  </span>
                  <span class="crayon-i">
                   width
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   of
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   image
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00819478099323-16">
                 </div>
                 <div class="crayon-line" id="crayon-576852be00819478099323-17">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   filterDim
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   dimension
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   of
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   convolutional
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   filter
                  </span>
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00819478099323-18">
                 </div>
                 <div class="crayon-line" id="crayon-576852be00819478099323-19">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   numFilters
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   number
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   of
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   convolutional
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   filters
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00819478099323-20">
                 </div>
                 <div class="crayon-line" id="crayon-576852be00819478099323-21">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   poolDim
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   dimension
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   of
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   pooling
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   area
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00819478099323-22">
                 </div>
                 <div class="crayon-line" id="crayon-576852be00819478099323-23">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   numClasses
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   number
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   of
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   classes
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   to
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   predict
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00819478099323-24">
                 </div>
                 <div class="crayon-line" id="crayon-576852be00819478099323-25">
                  <span class="crayon-ta">
                   %
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00819478099323-26">
                 </div>
                 <div class="crayon-line" id="crayon-576852be00819478099323-27">
                  <span class="crayon-ta">
                   %
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00819478099323-28">
                 </div>
                 <div class="crayon-line" id="crayon-576852be00819478099323-29">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   Returns
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00819478099323-30">
                 </div>
                 <div class="crayon-line" id="crayon-576852be00819478099323-31">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   Wc
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   filterDim
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   x
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   filterDim
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   x
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   numFilters
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   parameter
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   matrix
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00819478099323-32">
                 </div>
                 <div class="crayon-line" id="crayon-576852be00819478099323-33">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   Wd
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   numClasses
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   x
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   hiddenSize
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   parameter
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   matrix
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   hiddenSize
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   is
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00819478099323-34">
                 </div>
                 <div class="crayon-line" id="crayon-576852be00819478099323-35">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   calculated
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   as
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   numFilters
                  </span>
                  <span class="crayon-o">
                   *
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   imageDim
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-v">
                   filterDim
                  </span>
                  <span class="crayon-o">
                   +
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-o">
                   /
                  </span>
                  <span class="crayon-v">
                   poolDim
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-o">
                   ^
                  </span>
                  <span class="crayon-cn">
                   2
                  </span>
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00819478099323-36">
                 </div>
                 <div class="crayon-line" id="crayon-576852be00819478099323-37">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   bc
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   bias
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   for
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   convolution
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   layer
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   of
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   size
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   numFilters
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   x
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00819478099323-38">
                 </div>
                 <div class="crayon-line" id="crayon-576852be00819478099323-39">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   bd
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   bias
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-st">
                   for
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   dense
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   layer
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   of
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   size
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   hiddenSize
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   x
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00819478099323-40">
                 </div>
                 <div class="crayon-line" id="crayon-576852be00819478099323-41">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00819478099323-42">
                  <span class="crayon-v">
                   outDim
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   imageDim
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   -
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   filterDim
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   +
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-o">
                   /
                  </span>
                  <span class="crayon-v">
                   poolDim
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be00819478099323-43">
                  <span class="crayon-v">
                   hiddenSize
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   outDim
                  </span>
                  <span class="crayon-o">
                   ^
                  </span>
                  <span class="crayon-cn">
                   2
                  </span>
                  <span class="crayon-o">
                   *
                  </span>
                  <span class="crayon-v">
                   numFilters
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00819478099323-44">
                 </div>
                 <div class="crayon-line" id="crayon-576852be00819478099323-45">
                  <span class="crayon-ta">
                   %
                  </span>
                  <span class="crayon-o">
                   %
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   Reshape
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-i">
                   theta
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00819478099323-46">
                 </div>
                 <div class="crayon-line" id="crayon-576852be00819478099323-47">
                  <span class="crayon-v">
                   indS
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00819478099323-48">
                  <span class="crayon-v">
                   indE
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   filterDim
                  </span>
                  <span class="crayon-o">
                   ^
                  </span>
                  <span class="crayon-cn">
                   2
                  </span>
                  <span class="crayon-o">
                   *
                  </span>
                  <span class="crayon-v">
                   numFilters
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be00819478099323-49">
                  <span class="crayon-v">
                   Wc
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   reshape
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-e">
                   theta
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   indS
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-v">
                   indE
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   filterDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   filterDim
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   numFilters
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00819478099323-50">
                  <span class="crayon-v">
                   indS
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   indE
                  </span>
                  <span class="crayon-o">
                   +
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be00819478099323-51">
                  <span class="crayon-v">
                   indE
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   indE
                  </span>
                  <span class="crayon-o">
                   +
                  </span>
                  <span class="crayon-e ">
                   hiddenSize*
                  </span>
                  <span class="crayon-v">
                   numClasses
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00819478099323-52">
                  <span class="crayon-v">
                   Wd
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   reshape
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-e">
                   theta
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   indS
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-v">
                   indE
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   numClasses
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   hiddenSize
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be00819478099323-53">
                  <span class="crayon-v">
                   indS
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   indE
                  </span>
                  <span class="crayon-o">
                   +
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00819478099323-54">
                  <span class="crayon-v">
                   indE
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-v">
                   indE
                  </span>
                  <span class="crayon-o">
                   +
                  </span>
                  <span class="crayon-v">
                   numFilters
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be00819478099323-55">
                  <span class="crayon-v">
                   bc
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   theta
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   indS
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-v">
                   indE
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00819478099323-56">
                  <span class="crayon-v">
                   bd
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   theta
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   indE
                  </span>
                  <span class="crayon-o">
                   +
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-st">
                   end
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                 <div class="crayon-line" id="crayon-576852be00819478099323-57">
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00819478099323-58">
                 </div>
                 <div class="crayon-line" id="crayon-576852be00819478099323-59">
                  <span class="crayon-st">
                   end
                  </span>
                 </div>
                </div>
               </td>
              </tr>
             </tbody>
            </table>
           </div>
          </div>
          <!-- [Format Time: 0.0926 seconds] -->
          <p>
          </p>
          <div class="cnblogs_code_toolbar">
           <span class="cnblogs_code_copy">
            <p title="复制代码">
             <img src="http://dataunion.org/wp-content/uploads/2014/12/copycode3.gif"/>
            </p>
           </span>
          </div>
         </div>
         <p>
         </p>
         <p>
          <strong>
           2013.12.30:
          </strong>
         </p>
         <p>
          微博网友@路遥_机器学习利用matlab自带的优化函数conv2,实现的mean-pooling，可以大大加快速度，大家可以参考。cnnPool.m文件里面：
         </p>
         <div class="cnblogs_code">
          <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
          <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-576852be00820094149751" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
           <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
            <span class="crayon-title">
            </span>
            <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
             <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
              <div class="crayon-button-icon">
              </div>
             </div>
             <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
              <div class="crayon-button-icon">
              </div>
             </div>
             <div class="crayon-button crayon-wrap-button" title="切换自动换行">
              <div class="crayon-button-icon">
              </div>
             </div>
             <div class="crayon-button crayon-expand-button" title="点击展开代码">
              <div class="crayon-button-icon">
              </div>
             </div>
             <div class="crayon-button crayon-copy-button" title="复制代码">
              <div class="crayon-button-icon">
              </div>
             </div>
             <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
              <div class="crayon-button-icon">
              </div>
             </div>
            </div>
           </div>
           <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
           </div>
           <div class="crayon-plain-wrap">
            <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
             tmp = conv2(convolvedFeatures(:,:,numFeature,numImage), ones(poolDim),'valid'); 
pooledFeatures(:,:,numFeature,numImage) =1./(poolDim^2)*tmp(1:poolDim:end,1:poolDim:end);
            </textarea>
           </div>
           <div class="crayon-main" style="">
            <table class="crayon-table">
             <tbody>
              <tr class="crayon-row">
               <td class="crayon-nums " data-settings="show">
                <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
                 <div class="crayon-num" data-line="crayon-576852be00820094149751-1">
                  1
                 </div>
                 <div class="crayon-num crayon-striped-num" data-line="crayon-576852be00820094149751-2">
                  2
                 </div>
                </div>
               </td>
               <td class="crayon-code">
                <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
                 <div class="crayon-line" id="crayon-576852be00820094149751-1">
                  <span class="crayon-v">
                   tmp
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   conv2
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-e">
                   convolvedFeatures
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   numFeature
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   numImage
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-e">
                   ones
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   poolDim
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-s">
                   'valid'
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                  <span class="crayon-h">
                  </span>
                 </div>
                 <div class="crayon-line crayon-striped-line" id="crayon-576852be00820094149751-2">
                  <span class="crayon-e">
                   pooledFeatures
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   numFeature
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-v">
                   numImage
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-h">
                  </span>
                  <span class="crayon-o">
                   =
                  </span>
                  <span class="crayon-cn">
                   1.
                  </span>
                  <span class="crayon-o">
                   /
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-v">
                   poolDim
                  </span>
                  <span class="crayon-o">
                   ^
                  </span>
                  <span class="crayon-cn">
                   2
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-o">
                   *
                  </span>
                  <span class="crayon-e">
                   tmp
                  </span>
                  <span class="crayon-sy">
                   (
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-v">
                   poolDim
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-st">
                   end
                  </span>
                  <span class="crayon-sy">
                   ,
                  </span>
                  <span class="crayon-cn">
                   1
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-v">
                   poolDim
                  </span>
                  <span class="crayon-o">
                   :
                  </span>
                  <span class="crayon-st">
                   end
                  </span>
                  <span class="crayon-sy">
                   )
                  </span>
                  <span class="crayon-sy">
                   ;
                  </span>
                 </div>
                </div>
               </td>
              </tr>
             </tbody>
            </table>
           </div>
          </div>
          <!-- [Format Time: 0.0054 seconds] -->
         </div>
         <p>
         </p>
         <p>
         </p>
         <p>
          <strong>
           参考资料：
          </strong>
         </p>
         <p>
          <a href="http://www.cnblogs.com/tornadomeet/archive/2013/05/05/3061457.html">
           Deep learning：三十八(Stacked CNN简单介绍)
          </a>
          <a href="http://www.cnblogs.com/tornadomeet/archive/2013/05/05/3061457.html">
           <br/>
          </a>
         </p>
         <p>
          <a href="http://ufldl.stanford.edu/tutorial/index.php/Convolutional_Neural_Network">
           UFLDL：Convolutional Neural Network
          </a>
         </p>
         <p>
          <a href="http://ufldl.stanford.edu/tutorial/index.php/Exercise:_Convolutional_Neural_Network">
           UFLDL：Exercise: Convolutional Neural Network
          </a>
         </p>
         <p>
          <a href="http://ufldl.stanford.edu/tutorial/index.php/Optimization:_Stochastic_Gradient_Descent">
           UFLDL：Optimization: Stochastic Gradient Descent
          </a>
         </p>
         <p>
          <a href="http://blog.csdn.net/zouxy09/article/details/9993371">
           zouxy09博文：
          </a>
          <a href="http://blog.csdn.net/zouxy09/article/details/9993371">
           Deep Learning论文笔记之（四）CNN卷积神经网络推导和实现
          </a>
         </p>
         <p>
          <a href="http://cogprints.org/5869/1/cnn_tutorial.pdf">
           论文
          </a>
          <a href="http://cogprints.org/5869/1/cnn_tutorial.pdf">
           Notes on Convolutional Neural Networks,
          </a>
          <a href="http://cogprints.org/5869/1/cnn_tutorial.pdf">
           Jake Bouvrie
          </a>
          <a href="http://cogprints.org/5869/1/cnn_tutorial.pdf">
           <br/>
          </a>
         </p>
         <p>
          <a href="file:///https://dl.dropboxusercontent.com/u/19557502/2_03_output_layer_gradient.pdf">
           Larochelle关于DL的课件:
          </a>
          <a href="file:///https://dl.dropboxusercontent.com/u/19557502/2_03_output_layer_gradient.pdf">
           Output layer gradient
          </a>
         </p>
         <p>
          <a href="file:///https://github.com/rasmusbergpalm/DeepLearnToolbox/blob/master/CNN/cnnbp.m">
           github.com/rasmusbergpalm/DeepLearnToolbox/blob/master/CNN/cnnbp.m
          </a>
         </p>
         <p>
          <a href="https://github.com/amaas/stanford_dl_ex">
           https://github.com/amaas/stanford_dl_ex
          </a>
         </p>
         <p>
          <a href="http://yann.lecun.com/exdb/mnist/">
           http://yann.lecun.com/exdb/mnist/
          </a>
         </p>
         <p>
         </p>
        </div>
       </div>
       <div id="MySignature">
        文章出处：http://www.cnblogs.com/tornadomeet
       </div>
      </div>
      <div>
       <strong>
        注：转载文章均来自于公开网络，仅供学习使用，不会用于任何商业用途，如果侵犯到原作者的权益，请您与我们联系删除或者授权事宜，联系邮箱：contact@dataunion.org。转载数盟网站文章请注明原文章作者，否则产生的任何版权纠纷与数盟无关。
       </strong>
      </div>
      <!--content_text-->
      <div class="fenxian">
       <!-- JiaThis Button BEGIN -->
       <div class="jiathis_style_32x32">
        <p class="jiathis_button_weixin">
        </p>
        <p class="jiathis_button_tsina">
        </p>
        <p class="jiathis_button_qzone">
        </p>
        <p class="jiathis_button_cqq">
        </p>
        <p class="jiathis_button_tumblr">
        </p>
        <a class="jiathis jiathis_txt jtico jtico_jiathis" href="http://www.jiathis.com/share" target="_blank">
        </a>
        <p class="jiathis_counter_style">
        </p>
       </div>
       <!-- JiaThis Button END -->
      </div>
     </article>
     <!--content-->
     <!--相关文章-->
     <div class="xianguan">
      <div class="xianguantitle">
       相关文章！
      </div>
      <ul class="pic">
       <li>
        <a href="http://dataunion.org/20811.html">
         <img src="http://dataunion.org/wp-content/uploads/2015/09/t0133fcacae8523307b_副本-300x200.jpg"/>
        </a>
        <a class="link" href="http://dataunion.org/20811.html" rel="bookmark" title="大神亲传：26条深度学习的金科玉律！">
         大神亲传：26条深度学习的金科玉律！
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/20798.html">
         <img src="http://dataunion.org/wp-content/uploads/2015/09/t0159fd758ea17b4ba5-300x199.jpg"/>
        </a>
        <a class="link" href="http://dataunion.org/20798.html" rel="bookmark" title="各种编程语言的深度学习库整理大全！">
         各种编程语言的深度学习库整理大全！
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/20587.html">
         <img src="http://dataunion.org/wp-content/uploads/2015/08/t0192a35f52bc6e5eab-300x188.jpg"/>
        </a>
        <a class="link" href="http://dataunion.org/20587.html" rel="bookmark" title="基于Python的卷积神经网络和特征提取">
         基于Python的卷积神经网络和特征提取
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/20480.html">
         <img src="http://dataunion.org/wp-content/uploads/2015/08/thumb.600_0_副本-300x162.jpg"/>
        </a>
        <a class="link" href="http://dataunion.org/20480.html" rel="bookmark" title="99%的码农都会忽略的重要问题：深度神经网络的可解释性">
         99%的码农都会忽略的重要问题：深度神经网络的可解释性
        </a>
       </li>
      </ul>
     </div>
     <!--相关文章-->
     <div class="comment" id="comments">
      <!-- You can start editing here. -->
      <!-- If comments are open, but there are no comments. -->
      <div class="title">
       期待你一针见血的评论，Come on！
      </div>
      <div id="respond">
       <p>
        不用想啦，马上
        <a href="http://dataunion.org/wp-login.php?redirect_to=http%3A%2F%2Fdataunion.org%2F5395.html">
         "登录"
        </a>
        发表自已的想法.
       </p>
      </div>
     </div>
     <!-- .nav-single -->
    </div>
    <!--Container End-->
    <aside id="sitebar">
     <div class="sitebar_list2">
      <div class="wptag">
       <span class="tagtitle">
        热门标签+
       </span>
       <div class="tagg">
        <ul class="menu" id="menu-%e5%8f%8b%e6%83%85%e9%93%be%e6%8e%a5">
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-1605" id="menu-item-1605">
          <a href="http://taidizh.com/">
           泰迪智慧
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-20884" id="menu-item-20884">
          <a href="http://www.transwarp.cn/">
           星环科技
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-3538" id="menu-item-3538">
          <a href="http://datall.org/">
           珈和遥感
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-20888" id="menu-item-20888">
          <a href="http://www.chinahadoop.cn/">
           小象学院
          </a>
         </li>
        </ul>
       </div>
      </div>
     </div>
     <div class="sitebar_list">
      <div class="textwidget">
       <div align="center">
        <a href="http://study.163.com/course/courseMain.htm?courseId=991022" target="_blank">
         <img src="http://dataunion.org/wp-content/uploads/2016/03/dv.jpg"/>
        </a>
       </div>
      </div>
     </div>
     <div class="sitebar_list">
      <h4 class="sitebar_title">
       文章分类
      </h4>
      <div class="tagcloud">
       <a class="tag-link-44" href="http://dataunion.org/category/industry/demo" style="font-size: 10.204724409449pt;" title="4个话题">
        Demo展示
       </a>
       <a class="tag-link-31" href="http://dataunion.org/category/experts" style="font-size: 15.826771653543pt;" title="52个话题">
        专家团队
       </a>
       <a class="tag-link-870" href="http://dataunion.org/category/tech/ai" style="font-size: 19.795275590551pt;" title="273个话题">
        人工智能
       </a>
       <a class="tag-link-488" href="http://dataunion.org/category/%e5%8a%a0%e5%85%a5%e6%95%b0%e7%9b%9f" style="font-size: 8pt;" title="1个话题">
        加入数盟
       </a>
       <a class="tag-link-869" href="http://dataunion.org/category/tech/viz" style="font-size: 17.204724409449pt;" title="93个话题">
        可视化
       </a>
       <a class="tag-link-30" href="http://dataunion.org/category/partners" style="font-size: 10.645669291339pt;" title="5个话题">
        合作伙伴
       </a>
       <a class="tag-link-889" href="http://dataunion.org/category/parterc" style="font-size: 11.582677165354pt;" title="8个话题">
        合作会议
       </a>
       <a class="tag-link-104" href="http://dataunion.org/category/books" style="font-size: 12.96062992126pt;" title="15个话题">
        图书
       </a>
       <a class="tag-link-220" href="http://dataunion.org/category/tech/base" style="font-size: 19.850393700787pt;" title="281个话题">
        基础架构
       </a>
       <a class="tag-link-219" href="http://dataunion.org/category/tech/analysis" style="font-size: 19.409448818898pt;" title="232个话题">
        数据分析
       </a>
       <a class="tag-link-887" href="http://dataunion.org/category/tech/dm" style="font-size: 13.291338582677pt;" title="17个话题">
        数据挖掘
       </a>
       <a class="tag-link-34" href="http://dataunion.org/category/tech" style="font-size: 20.732283464567pt;" title="404个话题">
        文章
       </a>
       <a class="tag-link-1" href="http://dataunion.org/category/uncategorized" style="font-size: 22pt;" title="693个话题">
        未分类
       </a>
       <a class="tag-link-4" href="http://dataunion.org/category/events" style="font-size: 14.503937007874pt;" title="29个话题">
        活动
       </a>
       <a class="tag-link-890" href="http://dataunion.org/category/tech/%e6%b7%b1%e5%ba%a6%e5%ad%a6%e4%b9%a0" style="font-size: 10.204724409449pt;" title="4个话题">
        深度学习
       </a>
       <a class="tag-link-221" href="http://dataunion.org/category/tech/devl" style="font-size: 18.968503937008pt;" title="193个话题">
        编程语言
       </a>
       <a class="tag-link-888" href="http://dataunion.org/category/career" style="font-size: 15.661417322835pt;" title="48个话题">
        职业规划
       </a>
       <a class="tag-link-5" href="http://dataunion.org/category/jobs" style="font-size: 14.11811023622pt;" title="25个话题">
        职位
       </a>
       <a class="tag-link-871" href="http://dataunion.org/category/industry" style="font-size: 15.716535433071pt;" title="49个话题">
        行业
       </a>
       <a class="tag-link-613" href="http://dataunion.org/category/industry/case" style="font-size: 16.984251968504pt;" title="84个话题">
        行业应用
       </a>
       <a class="tag-link-885" href="http://dataunion.org/category/industry/news" style="font-size: 17.425196850394pt;" title="102个话题">
        行业资讯
       </a>
       <a class="tag-link-10" href="http://dataunion.org/category/training" style="font-size: 14.228346456693pt;" title="26个话题">
        课程
       </a>
       <a class="tag-link-16" href="http://dataunion.org/category/sources" style="font-size: 15.661417322835pt;" title="48个话题">
        资源
       </a>
      </div>
     </div>
     <div class="sitebar_list">
      <h4 class="sitebar_title">
       功能
      </h4>
      <ul>
       <li>
        <a href="http://dataunion.org/wp-login.php?action=register">
         注册
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/wp-login.php">
         登录
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/feed">
         文章
         <abbr title="Really Simple Syndication">
          RSS
         </abbr>
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/comments/feed">
         评论
         <abbr title="Really Simple Syndication">
          RSS
         </abbr>
        </a>
       </li>
       <li>
        <a href="https://cn.wordpress.org/" title="基于WordPress，一个优美、先进的个人信息发布平台。">
         WordPress.org
        </a>
       </li>
      </ul>
     </div>
    </aside>
    <div class="clear">
    </div>
   </div>
   <!--main-->
   ﻿
   <footer id="dibu">
    <div class="about">
     <div class="right">
      <ul class="menu" id="menu-%e5%ba%95%e9%83%a8%e8%8f%9c%e5%8d%95">
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-18024" id="menu-item-18024">
        <a href="http://dataunion.org/category/partners">
         合作伙伴
        </a>
       </li>
       <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-20881" id="menu-item-20881">
        <a href="http://dataunion.org/contribute">
         文章投稿
        </a>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-20872" id="menu-item-20872">
        <a href="http://dataunion.org/category/%e5%8a%a0%e5%85%a5%e6%95%b0%e7%9b%9f">
         加入数盟
        </a>
       </li>
       <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-22441" id="menu-item-22441">
        <a href="http://dataunion.org/f-links">
         友情链接
        </a>
       </li>
       <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-20874" id="menu-item-20874">
        <a href="http://dataunion.org/aboutus">
         关于数盟
        </a>
       </li>
      </ul>
      <p class="banquan">
       数盟社区        ，
        做最棒的数据科学社区
      </p>
     </div>
     <div class="left">
      <ul class="bottomlist">
       <li>
        <a href="http://weibo.com/DataScientistUnion  " target="_blank" 　title="">
         <img src="http://dataunion.org/wp-content/themes/yzipi/images/weibo.png"/>
        </a>
       </li>
       <li>
        <a class="cd-popup-trigger" href="http://dataunion.org/5395.html#0">
         <img src="http://dataunion.org/wp-content/themes/yzipi/images/weixin.png"/>
        </a>
       </li>
      </ul>
      <div class="cd-popup">
       <div class="cd-popup-container">
        <h1>
         扫描二维码,加微信公众号
        </h1>
        <img src="http://dataunion.org/wp-content/themes/yzipi/images/2014-12-06-1515289049.png"/>
        <a class="cd-popup-close" href="http://dataunion.org/5395.html">
        </a>
       </div>
       <!-- cd-popup-container -->
      </div>
      <!-- cd-popup -->
     </div>
    </div>
    <!--about-->
    <div class="bottom">
     <a href="http://dataunion.org/">
      数盟社区
     </a>
     <a href="http://www.miitbeian.gov.cn/" rel="external nofollow" target="_blank">
      京ICP备14026740号
     </a>
     联系我们：
     <a href="mailto:contact@dataunion.org" target="_blank">
      contact@dataunion.org
     </a>
     <div class="tongji">
     </div>
     <!--bottom-->
     <div class="scroll" id="scroll" style="display:none;">
      ︿
     </div>
    </div>
   </footer>
   <!--dibu-->
  </div>
 </body>
</html>